Home
Main website
Display Sidebar
Hide Ads
Recent Changes
View Source:
CronNotes
Edit
PageHistory
Diff
Info
LikePages
You are viewing an old revision of this page.
View the current version
.
Scheduling under Linux is provided by cron(8). crontab -e as a user will edit the users crontab entry (which is hidden somewhere in /var/spool/cron.) You need to get the format right - read crontab(5) for the format of the entry. The cron.d/cron.daily etc seem to vary slightly between distros. The basic guts of them are, put a script in /etc/cron.daily and the cron daemon will run it once a day (at whatever time it runs that job - 3am or whenever 'midnight' maintenance is scheduled.) These files are just normal shell scripts - no cron control info needed. same for /etc/cron.{hourly,weekly,monthly} /etc/cron.d has single-file crontab entries - these are crontab entries, so read crontab(5) again ;). EG: # /etc/cron.d/exim: crontab fragment for exim # Run queue every 15 minutes 08,23,38,53 * * * * mail if [[ -x /usr/sbin/exim -a -f /etc/exim/exim.conf ]; then /usr/sbin/exim -q ; fi Every 15 minutes (8 past the hour, 23 past the hour etc) on every hour, every day, etc etc, as user mail, run the command 'if [[] ... fi' The if magic is a sanity check - to check that its possible to run exim and there is an exim.conf file, before bothering to do anything else. /etc/crontab also has entries - the ones in my debian system tell cron to, every day, week, month, run the entries in /etc/cron.{daily,weekly,monthly}, respectively. In short, the easiest thing for you to do, if you want your script run daily, is to drop it in /etc/cron.daily. if it needs custom runtimes, put them in /etc/cron.d/ in a crontab file.
One page links to
CronNotes
:
UserSubmittedNotes