cron is a task scheduler based on clock time that runs on Linux-based machines.

learn more… | top users | synonyms

38
votes
3answers
926 views

What is the point of system-autodeath?

In a previous question I found a "system autodeath cron job" which would shut down my default network route daily. As I have never heard of such a thing before, I would like to know what it exactly ...
35
votes
8answers
66k views

Run a command every week with Cron?

Simple question- what would a crontab entry look like for a command I want to run every week on Saturday at 8:05 AM?
30
votes
8answers
39k views

How can I get a script to run every day on Mac OS X?

Cron? Launchd? iCal?? If so, how?
23
votes
3answers
13k views

Log of cron actions on OS X

Does the cron which comes with OS X log its actions anywhere? I'm not looking for output of any particular cron job, but rather log of what cron is doing. On a couple linux machines I've checked, ...
19
votes
3answers
34k views

How to run a cron job as a specific user?

I would like to run a cron job as a specific user on my machine. How may I specify the user for a cron job to run as?. I am running on Ubuntu 10.0.4 [Edit] The cron jobs will be running on a ...
18
votes
5answers
24k views

How can I view results of my cron jobs?

I see so many guides on how to run crontab, but what I need right now is to learn how to Find log files about cron jobs Configure what gets logged
12
votes
2answers
8k views

Set a cron every certain hours between certain hours

How can I set a cron to run every 2 hours between 8 am and 5 pm for example? Is this possible?
10
votes
4answers
8k views

Can I make cron “random”?

Maybe I'm completely nuts, and if so - that's fine. But how would I schedule a job to on-some-random-schedule broadcast a goofy message, like from fortune? clarification yes - this is my personal ...
9
votes
5answers
40k views

How to stop a currently running cron job?

How can I stop a cron job which is currently running?
9
votes
8answers
7k views

Error adding cronjobs in Mac OS X Lion

Until now, I have never attempted adding a crontask on my Mac. To my surprise, it threw an error.. [hayek@mac:/www/] 02:33:22 PM: crontab -e ...
9
votes
2answers
4k views

Common Mac OS folders/settings to check (when trying to get rid of a pesky self-launching app)

If there's an app that starts up by itself, what would the most efficient places to look for it be? Does anyone have a nice comprehensive list of where to check for Startup Items, Login Items, Login ...
9
votes
2answers
6k views

Difference between /etc/crontab and “crontab -e”

What is the difference between the crontab located in /etc/crontab and the crontab that can be edited using crontab -e?
9
votes
1answer
7k views

Run a cron job every 5 minutes between two times

Is there a way to specify a job that runs every 5 minutes between some start time and some end time on business days in a crontab? Update I think it's relevant that my start and end times are not at ...
8
votes
3answers
18k views

How do I run a launchd command as root

I have the following launchctl command as a .plist file. It's loaded and set to run once a day but, it needs to run as root and I'm not sure how to verify this. Also, this cron job basically CDs ...
8
votes
1answer
9k views

what is run-parts in /etc/crontab, and how do I use it

I have been digging through my Linux system. To try and understand how it all works In the /etc/crontab file. I see the following # run-parts 01 * * * * root run-parts /etc/cron.hourly 02 4 * * * ...
8
votes
3answers
3k views

How can I create a cron job that runs a task every three weeks?

I have a task that needs to be performed on my project schedule (3 weeks). I'm able to set up cron to do this every week, or (for example) on the 3rd week of every month - but can't find a way to do ...
7
votes
5answers
11k views

how to make run cron on OSX 10.6.2?

Note: this question is not about how to edit cron tab but how to make cron work I edited my cron using env EDITOR=joe crontab -e I entered 1 * * * * echo 'test' > ...
7
votes
3answers
2k views

Use cron to screen capture on Mac OS X

To analyze my own computer usage, not to spy on anyone (although it crossed my mind), I want to have cron capture the current screen every minute. * * * * * /bin/bash -c "/usr/sbin/screencapture ...
6
votes
5answers
12k views

cron: run a process but only if it isnt running?

Is there a way for me to tell cron to run an app BUT not run it if a process exist already?
6
votes
2answers
2k views

cron can't read PYTHONPATH environment variables?

I have added to the PYTHONPATH on my server's .bash_profile file. However it appears that cron isn't reading from it because I am getting import errors. If I run the exact command cron calls on the ...
6
votes
5answers
5k views

Run a cron job on the first Monday of every month?

I'd like to run a job from cron at 8.30 on the first Monday of every month. The cron Wikipedia page says While normally the job is executed when the time/date specification fields all match ...
6
votes
1answer
1k views

How to schedule a task with the Task Scheduler on Windows 7 that runs one minute later each day?

How to schedule a task with the Task Scheduler on Windows 7 that runs one minute later each day? That is on day one it runs at say 10:00 then the next day at 10:01, etc.
6
votes
3answers
7k views

How to set cron PATH globally (i.e. for all users) permanently?

We need to have /usr/local/bin in cron's path for all users. Is there a way to set it system-wide, without needing to edit each individual user's crontab? We've tried adding PATH to /etc/crontab: # ...
5
votes
1answer
223 views

Why does cron only offer minute granularity?

It feels like there are use cases for things you'd want to run once every 5 seconds, twice a minute, etc, but these are impossible with cron. Why hasn't second-level cron granularity been built into ...
5
votes
4answers
8k views

bash: using scp in cron job fails, but runs succesfully when run from command line

I am trying to use scp in a bash script run by cron (I am running this on Ubuntu 10.0.4 LTS). The script works fine (i.e. transfers and copies file1 and file2 to/from the remote server, when I run it ...
5
votes
3answers
2k views

Run Linux script at time 'n' on first day, 'n+15 mins' next day, and so on

I'm trying to take timelapse images using my webcam. What I want to do is run a script at midnight on 1st Jan, then 00:15 on 2nd Jan, 00:30, 3rd Jan and so on. This can keep running forever, I'll ...
5
votes
2answers
4k views

using either notify-send or zenity in Cron

I am trying to get cron to provide a screen alert when it spots a particular situation. I know the script is executed each minute but it will not display on the screen. script executed is: ...
5
votes
2answers
2k views

Only email on cron errors for jobs in cron.daily, cron.hourly, etc

I have several cron jobs that run (in /etc/cron.daily, /etc/cron.hourly, /etc/cron.weekly, etc.) and email root@localhost with the results. I'd like to stop those emails if the jobs are succeeding, ...
4
votes
4answers
365 views

How to use “date” to print tomorrow's day of the week

On CentOS 6 Linux I use date +%a in several cronjobs and scripts to generate logfile names like myprog-Tue.txt and this works well for me since many years. But now for one program I need to delete ...
4
votes
2answers
8k views

linux: how to run a command in a given directory

I simply want to just run a command (actually its a shell script) from a given directory as a cron job. How can I run it so that it is set to a given directory without using cd.
4
votes
9answers
1k views

How can I write a cron job that will block my internet from 7pm to 7am? (So I can get some sleep)

I am using OSX 10.6 and it has cron built in. How can I write a cron job that will block my internet from 7pm to 7am every day? Im sure this must be simple but I could only find one example online ...
4
votes
4answers
9k views

How can I permanently fix my date synchronize problem in linux?

Ubuntu 7.10 server i386 clock/date/time won't stay in sync. Are their log files I can view to tell when the clock changes? For a temporary fix, I created a file in /etc/cron.hourly: #!/bin/sh ntpdate ...
4
votes
4answers
2k views

with a shell script, it is possible to tell when it's run with cron vs run manually?

with a shell script, it is possible to tell when it's run with cron vs run manually? UPDATE: it was asked why I want to know. My cron job will be logging, and i want to be able to log if someone ...
4
votes
4answers
1k views

cron runs but nothing happens

I have created a script called "forward_email.sh" and set permissions to 777. It contains the following line: echo "It worked: $(date)" >> /home/noc/email.log I created a cron job with the ...
4
votes
2answers
2k views

Bash to delete a files older than X days

So I have a cron setup to make backups of a folder into a tarball every hour. I would like to add into the shell script that I'm using the ability to have files deleted automagically after about three ...
4
votes
2answers
2k views

How do I create a cron job that will commit my project changes to git on a weekly basis

I'm using git for the purposes of making a historical transcript of the changes made to my project. I understand it's not the ideal usage but it's the usage pattern I've chosen for various reasons ...
4
votes
4answers
1k views

Mac crontab is never created

I am trying to setup a cron on my mac, but it seems that it never finishes creating a crontab for my user. I open terminal and enter: $ crontab -e Which returns this: crontab: no crontab for ...
4
votes
10answers
18k views

How can I automatically take a screenshot of a website at a specified time? [closed]

I need to take a screenshot of a website automatically at a time specified by me. Ideally it would not be using my computer since it's not guaranteed to be on at the specified time. Is there some ...
4
votes
3answers
6k views

Timezone issue with cron

My cron jobs are computed one hour later compared to server time. I don't understand what is going on. My configuration is the following : Server time : Europe/Paris In /etc/default/cron I added ...
4
votes
2answers
1k views

Can Ubuntu play a video via cron job?

I'm developing a display system for a paint shop. I've set up a computer with Ubuntu to run the video and display it on a TV, running a PHP script that should update the video every hour via the ...
4
votes
5answers
4k views

Crontab deleted?

Instead of typing "crontab -e" I accidentally typed "crontab" and was stuck in the middle of a process so I aborted the process. Now when I go to crontab -e it's entirely blank. This isn't good at ...
4
votes
2answers
740 views

From what context is a cron task executed?

I am asking this question after royally destroying a Linux box. Let me give you some background so you know where I am coming from. I currently have (well... did have) a RedHat Linux box running ...
4
votes
1answer
481 views

system-wide crontab vs. user crontab to shutdown pc

I'm trying to shutdwon my pc at 2 am once a week. If I use the user crontab of root (sudo crontab -e) 30 2 * * 3 shutdown -h now the shutdown will not be performed. However, if I place the same ...
4
votes
1answer
3k views

crontab day of week vs. day of month?

I added this to /etc/crontab on a few different linux & freebsd systems: # monthly reboot: 3rd Tuesday of every month 56 07 15-21 * 2 root /sbin/shutdown -r now I want a reboot on the 3rd ...
4
votes
2answers
1k views

Should I worry about Daylight saving time when planning to schedule backups?

So if there is a day: https://secure.wikimedia.org/wikipedia/en/wiki/Daylight_saving_time when we have to e.g.: set our clock back from 3am to 2am. Ok. So if someone creates a cron job at 3am, ...
4
votes
1answer
217 views

Root account locked/suspended?

I'm shipping ts7800 boards running debian 6.07. After programming, some boards do not run their cron jobs, complaining that they do not recognise the user root. This happened on 2 out of 12 ...
4
votes
1answer
2k views

Is there a aliases file for sSMTP?

I installed sSMTP for sending emails from command line. I want to create some alias for cron jobs: $ sudo vim /etc/aliases # append this line at the end myname: root $ newaliases ...
4
votes
2answers
623 views

Auto suspend after X minutes to stop myself procrastinating

Right now, I'm using a line in /etc/crontab to run pm-suspend every 30 minutes, but I would like an application displaying a warning before suspending (for example a countdown in the taskbar). An ...
4
votes
2answers
1k views

rsync over SSH with cron in osx-environment

I want to automatically download files and folders from a Linux server to which I have an SSH (and FTP) account. The files shall be downloaded on a regular basis (I suppose a cron is the right tool to ...
4
votes
1answer
578 views

Shell script of mysqldump works fine when run manually, but does not run in the cron job?

I have a shell script to get a MySQL database dump. This script works fine when run manually #!/bin/sh fqn=/home/Mysqluser/daily_dumps/bookstore_`date +%Y%m%d_%H%M%S`.sql.gz mysqldump -u root -h ...