How to set up cron task on Ubuntu

Step 1

Create shell script

Example (doxygen.sh)

git pull
doxygen

Make it executable

$ sudo chmod +x doxygen.sh

Step 2

Execute crontab -e and add command to cron configuration file. Command must have format “minute hour day-of-month month day-of-week command”.

Example

00 17 * * * doxygen.sh

Step 3

Restart cron

$ sudo service cron restart

Get cron logs

$ sudo grep cron /var/log/syslog

View cron messages

$ cat /var/mail/username