canada flag  linkedinfacebook   Call Us Today: (613) 494-5010

Schedule nightly reboot in linux

Linux IT SupportSometimes it is a good idea to schedule a regular reboots, to clear the memory and remove any crashed processes.

This can be easily achieved by adding the task to a cron tab (Linux scheduling system):

First, open the crontab (as a root):

crontab -e

and add a line similar to this:

0 1   *   *   *    /sbin/shutdown -r 0

This will perform a nightly reboot at 1am. If you think that daily reboot is too much, you can schedule a weekly reboot:

0 1   *   *   sat    /sbin/shutdown -r 0

This will reboot the server on a Saturday at 1am.

Cron scheduler reference:

m      h    dom        mon   dow       command
minute hour dayOfMonth Month dayOfWeek commandToRun

 

sudo crontab -e
Last updated Oct 19, 2018