941 B
941 B
Cron
An overview of using Ubuntu's built in Cron system.
Edit Cron
sudo nano /etc/crontab
Auto Update & Upgrade & Reboot/Restart
22 2 * * * root /usr/bin/apt update -q -y >> /var/log/apt/automaticupdates.log
33 3 * * * root /usr/bin/apt upgrade -q -y >> /var/log/apt/automaticupdates.log
44 4 * * * root reboot
Advanced Configs
Below is a template/guide to creating your own crontab scripts!
Templates
[minute] [hour] [day_of_month] [month] [day_of_week] [user] [command_to_run]
* * * * * root /root/update.sh
Field | Values allowed |
---|---|
Minute | 0 to 59 |
Hour | 0 to 23 |
Day of month | 1 to 31 |
Month | 1 to 12 OR JAN to DEC |
Day of week | 0 to 6 OR SUN to SAT |
Special Syntax | Regular equivalent |
---|---|
@hourly | 0 * * * * |
@daily | 0 0 * * * |
@weekly | 0 0 * * 0 |
@monthly | 0 0 1 * * |
@yearly | 0 0 1 1 * |