From Indie IT Wiki
Jump to: navigation, search


Disable Email Notifictions

Cron by default sends an email to the user account executing cronjob. To disable it add your cron job adding the >/dev/null 2>&1 at the end of the file which redirects the output of the cron to /dev/null.

crontab -e
* * * * * >/dev/null 2>&1

Edit Cron Jobs Of Current User

crontab -e

List Jobs For Current User

crontab -l

List Jobs For Specified User

crontab -u fred -l

Remove Current User's Crontab With Prompt

crontab -i -r # This will invoke the following prompt

crontab: really delete fred's crontab? (y/n)

Remove Current User's Crontab Without Prompt

crontab -r


{minute} {hour} {day-of-month} {month} {day-of-week} {path-to-shell-script}

Execute Task Job On Reboot

@reboot /usr/local/bin/flexget daemon start -d

16.04 LTS > Use journalctl Command To Display Log

sudo journalctl -u cron
sudo journalctl -u cron -b | more
sudo journalctl -u cron -b | grep something
sudo journalctl -u cron -b | grep -i error



Predefined scheduling definitions...

Entry                      Description                                    Equivalent To
@yearly (or @annually)     Run once a year, midnight, Jan. 1st            0 0 1 1 *
@monthly                   Run once a month, midnight, first of month     0 0 1 * *
@weekly                    Run once a week, midnight on Sunday            0 0 * * 0
@daily                     Run once a day, midnight                       0 0 * * *
@hourly                    Run once an hour, beginning of hour            0 * * * *
@reboot                    Run at startup

System Cron Schedules

Predefined cron directories.

  • /etc/cron.d
  • /etc/cron.daily
  • /etc/cron.hourly
  • /etc/cron.monthly
  • /etc/cron.weekly

Thanks to Techmint for much of the above.