Skip to main content

crontab - Scheduler and logging

Crontab - Crontab is scheduler so you can launch scripts hourly/daily/weekly/monthly.

  1. type "sudo crontab -e" (Edit the crontab)
  2. Pick 1. nano unless you like other editors.

image.png

Add the following to the bottom of the crontab to run the script at 10AM Sunday

0 10  0 /scripts/<starchiver script> -options

image.png

CRONTAB LOGGING:

You also want  better crontab logging! this is easy.  Edit this file with nano nano /etc/rsyslog.d/50-default.conf
and remove the # from the line below.  The run sudo systemctl restart rsyslog which restart crontab.  There will be a new log
for your jobs in /var/log/cron.log

 

#  Default rules for rsyslog.
#
#                       For more information see rsyslog.conf(5) and /etc/rsyslog.conf

#
# First some standard log files.  Log by facility.
#
auth,authpriv.*                 /var/log/auth.log
*.*;auth,authpriv.none          -/var/log/syslog
cron.*                          /var/log/cron.log
#daemon.*                       -/var/log/daemon.log
kern.*                          -/var/log/kern.log
#lpr.*                          -/var/log/lpr.log
mail.*                          -/var/log/mail.log
#user.*                         -/var/log/user.log

#
# Logging for the mail system.  Split it up so that
# it is easy to write scripts to parse these files.
#
#mail.info                      -/var/log/mail.info
#mail.warn                      -/var/log/mail.warn
mail.err                        /var/log/mail.err