u20 crontab
┌───────────── minute (0 - 59)
│ ┌───────────── hour (0 - 23)
│ │ ┌───────────── day of the month (1 - 31)
│ │ │ ┌───────────── month (1 - 12)
│ │ │ │ ┌───────────── day of the week (0 - 6)
│ │ │ │ │
│ │ │ │ │
│ │ │ │ │
* * * * * command
install
apt install cron
enable service
systemctl enable --now cron
service cron status
edit config file
sudo ls /var/spool/cron/crontabs/
sudo vim /var/spool/cron/crontabs/
log
sudo apt-get install postfix
or add
>/dev/null 2>&1
to every job:
* * * * * yourCommand >/dev/null 2>&1
-
modify rsyslog config: open
/etc/rsyslog.d/50-default.conf
remove#
beforecron.*
-
restart rsyslog service:
sudo service rsyslog restart
- restart cron service:
sudo service cron restart
tail -f /var/log/cron.log
your_command 2>&1 | tee -a file.txt
https://serverfault.com/questions/136461/how-to-check-cron-logs-in-ubuntu