My Tech-Notes

Auto Reboot Ubuntu Server Using Cron

Generated: 2025-07-15 06:22:41
System: Ubuntu (root crontab)


Example Cron Jobs

Daily Reboot at 3:30 AM

30 3 * * * /sbin/shutdown -r now

Weekly Reboot Every Sunday at 4:00 AM

0 4 * * 0 /sbin/shutdown -r now

Alternative with reboot

0 4 * * 0 /sbin/reboot

How To Add It

  1. Open the root crontab:

    sudo crontab -e
    
  2. Add the desired line.

  3. Save and exit.

  4. Confirm with:

    sudo crontab -l
    

Check Where reboot or shutdown Lives

which reboot
which shutdown

Usually: /sbin/reboot and /sbin/shutdown


Check When It Rebooted

last reboot

Tips


Example for Safe Use

0 4 * * 0 /sbin/shutdown -r now

This will reboot your Ubuntu server every Sunday at 4:00 AM.