Cron daemon – recurrent tasks
Restrictions:
if /etc/cron.allow exists only users listed within can access crontab
if it does not exists everybody can use crontab, as far as its name is not listed in /etc/cron.deny (1 user per line)
if this does not exist neither everybody can use crontab
Commands:
to specify the editor to be used
export EDITOR=pico
to edit the crontab list for the current user
crontab -e
to display the crontab list for the current user
crontab -l
to remove the crontab list for the current user
crontab -r
Syntax:
consists in 5 fields for specifying the period and the command to be run
* * * * * command args
[minutes 0-59] [hours 0-23] [day of month 1-31] [month 1-12] [day of week 0-6 sunday=0] [command] [args for the command]
each field is represented by an * and can be a:
- number
- number, number
- number-number (which means an interval)
*/n means “every n times” according to the position of the * (mins, hours, days…)
eg.
* * */1 * * updatedb
means “run updatedb every day”
email:
by default cron jobs send an email to the user account executing the cronjob. If not needed add at the end of the crontab command
> /dev/null 2>&1
logging:
if you need to log the program output simply add at the end of the command line
> /home/user/program.log
which is the path to the file log.
Related posts:
- updatedb (slocate, locate) privacy settings
- AcetoneISO the Daemon Tools and UltraISO for linux
- shell Jobs
- Disk quota management
- fast deployment of secure (APOP) Qpopper email pop3 server
- hide user list in Ubuntu Lucid 10.04 login
- How to delete undelatable files and folders in linux
Print This Post
|
Email This Post