Search This Blog

Sunday, July 31, 2011

Schedule tasks using cron

#crontab -e -u username
Now enter something like below where * have meaning as given below
* * * * * command
mins hrs DOM MOY DOW
00-59 00-23 1-31 1-12 0-7 0=7=Sun 1=Mon,..

Example : Users often forget to shutdown their machines and go home
Hence, machine should auto shutdown at 11 pm

# crontab -e
============
00 23 * * * root /sbin/shutdown -h now

To see cron jobs for user
#crontab -l -u usernaem

2 comments:

Anonymous said...

I read that cron jobs for users other root require the user to be in the cron.allow file. Is this true?

Anonymous said...

by default the cron.allow file does not exist and any user NOT in the cron.deny file can use cron (by default no one is in the deny file). If the cron.allow file exists it overrides the cron.deny file and a user MUST be in cron.allow file to use cron.