Crontab is a short form of cron table. It is a configuration file that specifies shell commands to run periodically on a given schedule.

learn more… | top users | synonyms

38
votes
8answers
77k 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?
13
votes
2answers
8k 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?
11
votes
5answers
76k views

How to execute shell script via crontab?

I have a notify.sh script that looks like: notify-send "hi welcome" My crontab notification for 2 PM: 0 14 * * * home/hacks/notify.sh However, this doesn't work. What is the problem?
10
votes
1answer
15k views

Running program every 2 minutes with crontab

What does 2 * * * * means in crontab context? I want to run my program every 2 minutes; is that what 2 * * * * means?
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 ...
7
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
7k 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 ...
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, ...
5
votes
2answers
465 views

Crontab Error Emails: Set Sender to Root Using -f

For a crontab entry in this format, */1 * * * * /usr/bin/php /app/<userid>/command --flag='value' I see this message emailed to <userid>@host (and view via mail) at one per minute: ...
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
2answers
805 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
629 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 ...
3
votes
4answers
2k views

Is it possible to use variables in crontab -e?

Can I say: MYPATH=/root/scripts MYSCRIPT=doit.sh 0 1 * * * $MYPATH/$MYSCRIPT in crontab -e ? Is it possible to use variables in crontab -e ?
3
votes
4answers
827 views

How do I add a job to cron?

So, here's what I did: Logged in as root via Shell Typed crontab -e Typed */30 * * * * /path_to_website/cronjobs/cron.php And now what? How do I save it? I just closed Putty and then logged back ...
3
votes
2answers
6k views

how to run cron jobs on GMT not local time?

How can I make cron jobs run on GMT, not local time? this is my crontab file: #m h d m wday command TZ=GMT 5 0,6,12,18 * * * ~/Documents/bash/transfer.sh my jobs seem ...
3
votes
1answer
3k views

Linux - check when crontab file was last amended

How can i get the last updated date/time of the crontab file. not when cron was last run but instead when was the crontab file amended last
3
votes
2answers
2k views

Multiple crontabs for one user

is there a way to use multiple crontab files for one user? Thinking something along the lines of crontab file per project instead of crontab per user... Any help is appreciated...
3
votes
1answer
2k views

How do I make crontab generate a unique log each time it runs a job?

Here is the crontab job /usr/local/bin/python2.7 /home/scripts/script.py >> /home/scripts/logs/log.log 2>&1 How do I generate a new log every time the job is run? I am cool with ...
3
votes
1answer
7k views

Bad minute in crontab?

I get the following error in my syslog: Oct 17 13:14:03 tracker cron[873]: (*system*) ERROR (Syntax error, this crontab file will be ignored) Oct 17 13:14:03 tracker cron[873]: Error: bad minute; ...
3
votes
1answer
107 views

If I restart crond, will scripts get interrupted?

I am changing my /etc/crontab file. When I execute service crond restart will my jobs/scripts that just begun executing by crond be terminated or not ?
2
votes
2answers
904 views

Crontab : Permission denied

My crontab (running as user) contains the following command 00-59 00-23 * * * /usr/bin/smbget -R smb://192.168.10.32/Data -u USER -p PASSWORD But I am getting an error as You don't have ...
2
votes
2answers
8k views

How to create folders according to date in Linux?

Is there any other short/easier and smarter way to do the following in Linux? cd /home/abcd/dammi mkdir $(date +%Y-%m) cd $(date +%Y-%m) mkdir $(date +%d) # RESULT : /home/abcd/dammi/2011-05/26 cd ...
2
votes
5answers
245 views

randomised cron command

I'd like to write a cron command so that a job would execute once at some random time during the week - is this possible without having the crontab modify itself? I've considered writing a function ...
2
votes
2answers
1k views

stdout and stderr of script doesn't get redirected when executed by cron

./script &>> log.txt I get a nice logfile, but if I have the same command executed by cron, lets say the crontab looks like this: * * * * * '/home/user/script &>> /home/user/log.txt' ...
2
votes
3answers
8k views

Crontab not working in Ubuntu 10.04

I installed it in a machine at work and it wouldn't do anything, no matter what I did. So now I have it on virtualbox at home and it also doesn't work. Here's what I'm trying to do: Have a file on ...
2
votes
1answer
960 views

Cron job on Mac not running during sleep

I have a cron job that will mail a list of all Google Tasks to my email address daily at 7am. (http://privacylog.blogspot.com/2010/07/api-for-google-tasks.html) I am running this on my laptop which, ...
2
votes
5answers
14k views

How to use crontab to run a script as nobody

This is on a CentOS machine. I'm trying to run a script as user nobody (or as a user with minimal permissions) at a certain time every day. Here is nobody: [root@CentOS % ~] grep "^nobody" ...
2
votes
1answer
475 views

If I schedule a cron job to run at midnight, will it run at the start or end of the day?

If I schedule a cron job to run at midnight on a specific day, will the job run at the beginning of the day, or at the end of the day? For example: # Runs at midnight on 20th February: 0 0 20 2 *
2
votes
2answers
209 views

How can I change the directory a command thinks it is running in?

How can I run a command that is in a different directory so that the command thinks I've ran it in the current directory? If a command is using basename() or argv[0] (or whatever it's called) to get ...
2
votes
2answers
3k views

Cron ignoring an update to crontab

I've commented out a line in the crontab on a debian server, which I guess was there by default yet was causing me to get error emails every hour: # m h dom mon dow user command 17 * * * * root ...
2
votes
3answers
555 views

crontab still sending emails even with > /dev/null

I have a crontab (root) that runs a script and output is set to > /dev/null but I always get the emails whenever it runs. I only want to receive error emails. # Rackspace driveclient update (12pm ...
2
votes
2answers
1k views

Cron job not working consistently

I have a cron job: 1 0 * * * /usr/bin/wget -q -O /dev/null 'http://123.456.78.90/index/parsedata?&today=1' It should gather a bunch of data from the DB at 12:01am each day, organize it for use ...
2
votes
1answer
319 views

Cancel a cronjob or an automatically loaded process on OS X

I'm currently being bugged by Mail.app popping open every friday at the same time and simultaniously I receive mails from an app iBackup which I used to have installed. I would like to get rid of it ...
2
votes
1answer
618 views

Set default editor for crontab -e invoked with sudo

I'm using Bash on Debian Squeeze. I just read this topic: change default text editor for crontab to vim I have exported both variables VISUAL and EDITOR to vim for normal user and for root. And this ...
2
votes
1answer
967 views

Deleting files and emptying trash using cron

I'm new to making crontab files and I decided to try and make a job that would delete the contents of my Downloads folder, and then empty the trash. This is what I have: 0 9 * * * rm ...
2
votes
1answer
698 views

How do I compress a directory on a Unix web server and email it on a sheduled basis?

After hearing about various high profile website creators getting stiffed recently after hardware failures on their servers I would like to implement a backup strategy on my websites. I have cPanel ...
2
votes
2answers
887 views

Working with git via crontab

I have the following shell script #!/bin/bash REPODIR=$HOME/work/repository/ cd $REPODIR var=`git fetch --dry-run 2>&1` echo $var > $HOME/error.txt I want to run my script every minute, ...
2
votes
2answers
2k views

How to set CRON to execute a php file outside of a public html folder?

I have a php file located at, let's say, for example: /data/web/process.php This file is not publicly available (no virtual host is running in that folder, but apache is installed). I need to ...
2
votes
2answers
2k views

How to execute a php file with crontab?

I have ubuntu setup with lamp and I was wondering what I would type to start a php page say at 2am everyday. I am still studying how crontab works so I can't test to see which one works. So if I ...
2
votes
0answers
24 views

Performance loss when having too many files in /etc/cron.d?

Is there an amount of files in /etc/cron.d that would lead to worse performance? There are currently about 50 jobs in. In the future there can be up to 200 files in. Am I correct to expect the cron ...
2
votes
0answers
81 views

Mac Crontab Deleted

I was messing around with creating cron jobs and somehow I wound up deleting crontab out of /usr/bin. Does anyone know of a way that I can recover it without having to re-install multiple components ...
2
votes
5answers
1k views

rsync works fine until I put it in crontab (UPDATE: 'date' doesn't work in crontab)

I've got this rsync command that works just fine when I run it from the command line (Ubuntu Server 12.04.1 LTS). I'd like it to run every hour, on the hour, and output the results (along with errors) ...
2
votes
2answers
787 views

Do jobs in root's crontab still execute when logged in as another user?

I have edited my root's crontab. Will root's cron jobs still run when I'm logged in as another user?
1
vote
1answer
94 views

Shutting down Linux server on first Wednesday of every month

I have written a crontab entry as: 00 19 1-7 * 3 /sbin/init 0 It should turn my linux server off on the first Wednesday of every month. Unfortunately the server went off on today (Thursday). Can ...
1
vote
3answers
2k views

Why does this crontab file only run once?

I have the following crontab file: 2 * * * * /bin/date >> /home/jon/date_from_cron.txt I think this means "run every two minutes". However, it only runs once. Shortly after setting up this ...
1
vote
1answer
105 views

crontabs hour specification */1 is that the same as *

I am looking for clarification with the cron tab that I am working with. some job 1 * * * * some job 1 */1 * * * Are those jobs the same? The job will run the first minute every ...
1
vote
2answers
73 views

How to save Crontab edits?

I ran crontab -e and made some changes, now how do I save it?
1
vote
2answers
332 views

Run Crontab anytime after 4pm

I am trying to run a script through crontab in osx 10.8.5 that will run at 4:30. 30 16 * * 1-5 /Library/Frameworks/Python.framework/Versions/2.7/bin/python /Users/lego90511/PycharmProjects/Stock\ ...
1
vote
2answers
1k views

I want to run an rsync command at midnight but make it stop at 8am. How can i schedule the start AND END of a command?

I want to run an rsync command at midnight but make it stop at 8am. How can i schedule the start AND END of a command? I've looked into cronjobs but that will only start at a certain time. Any ideas ...