crontab tips

Crontab is client using the cron daemon that executes scheduled commands. Cron is started automatically from /etc/init.d on entering multi-user runlevels. Cron searches its spool area (/var/spool/cron/crontabs) for crontab files (which are named after accounts in /etc/passwd); crontabs found are loaded into memory. Note that crontabs in this directory should
not be accessed directly – the crontab command should be used to access and update them.

#--------------------------------------------------
# example unix/linux crontab file format:
#--------------------------------------------------

# min,hour,dayOfMonth,month,dayOfWeek command
#
# field          allowed values
# -----          --------------
# minute         0-59
# hour           0-23
# day of month   1-31
# month          1-12 (or names, see below)

# day of week    0-7 (0 or 7 is Sun, or use names)
#
#--------------------------------------------------

# run the drupal cron process every hour of every day
0 * * * * /usr/bin/fetchmail &> /dev/null


# run this apache kludge every minute of every day
* * * * * /var/www/devdaily.com/bin/check-apache.sh

# generate links to new blog posts twice a day

5 10,22 * * * /var/www/devdaily.com/bin/mk-new-links.php

# run the backup scripts at 4:30am
30 4 * * * /var/www/devdaily.com/bin/create-all-backups.sh


# re-generate the blog "categories" list (four times a day)
5 0,4,10,16 * * * /var/www/devdaily.com/bin/create-cat-list.sh
or
5 */4 * * * /var/www/devdaily.com/bin/create-cat-list.sh



# reset the contact form just after midnight
5 0 * * * /var/www/devdaily.com/bin/resetContactForm.sh

# rotate the ad banners every five minutes


0,20,40  * * * * /var/www/bin/ads/freshMint.sh
5,25,45  * * * * /var/www/bin/ads/greenTaffy.sh
10,30,50 * * * * /var/www/bin/ads/raspberry.sh
15,35,55 * * * * /var/www/bin/ads/robinsEgg.sh

# run it from 2 to 10
10 2-10 * * * /usr/bin/run

crontab -e to edit
crontab -l to list

About these ads

One response to “crontab tips

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s