This is a draft cheat sheet. It is a work in progress and is not finished yet.
Config and Schedule
Cron job script |
/etc/cron.daily/logrotate |
Config file |
/etc/logrotate.conf /etc/logrotate.d/ |
More frequent |
a. /etc/cron.hourly b.crontab (see below) |
At what time cron.daily
runs? grep run-parts /etc/crontab
Cron 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 -l
// current user specific |
create |
crontab -e
// current user specific |
user's crontab file |
// DON'T edit it directly CentOS:/var/spool/cron/$user Ubuntu:/var/spool/cron/crontabs/$user |
system-wide crontable file |
// Username is required in this file /etc/crontab |
|
|
Debug Logrotate
status |
cat /var/lib/logrotate/status |
mannually run |
logrotate -f $CONFIG_FILE |
dry run |
logroate -d $CONFIG_FILE |
|