united states of america usa  linkedinfacebookgoogle

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

Tel: (786) 646-6461   |   Toll-Free: (877) 454-0758
18350 NW 2nd Ave, Ste 406E | Miami, FL33169