Show Menu
Cheatography

Logrotate and Cron Job Cheat Sheet by

Configure and Schedule

Cron job script
/etc/c­ron.da­ily­/lo­groate
Config­uration file
/etc/l­ogr­ota­te.conf
Hourly or customized
a. /etc/c­ron.hourly
b. crontab (see below)
1. When does
cron.daily
run?
grep run-parts /etc/c­rontab

Cron job definition

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) 
# |  |  |  |  .---- day of week (0 - 6) (Sun=0 or 7)
# |  |  |  |  |
# *  *  *  *  * command to be executed
 

crontab

list crontab
crontab -l
// Current user specific
create crontab
crontab -e
// Current user specific
user's crontab file
// DON'T edit directly
CentOS­:/v­ar/­spo­ol/­cro­n/$user
Ubuntu /var/s­poo­l/c­ron­/cr­ont­abs­/$user
system­-wide crontab
// Username field is required
/etc/c­rontab
Example (arix-be)
# do daily/­wee­kly­/mo­nthly mainte­nance

# min   hour    day     month   weekday command

*/15    *       *       *       *       run-parts /etc/p­eri­odi­c/15min

0       *       *       *       *       run-parts /etc/p­eri­odi­c/h­ourly

0       2       *       *       *       run-parts /etc/p­eri­odi­c/daily

0       3       *       *       6       run-parts /etc/p­eri­odi­c/w­eekly

0       5       1       *       *       run-parts /etc/p­eri­odi­c/m­onthly
       
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Linux Command Line Cheat Sheet
          mod_rewrite Cheat Sheet
          Vim NERDTree Cheat Sheet