I need help with my dedicated Ubuntu server.
How can I reboot my server every 4 hours?
Asked
Active
Viewed 1.5k times
3

Zanna
- 70,465

G. Macasero
- 31
1 Answers
3
The crontab
Method
- Open your Terminal or SSH into your server
- Type
sudo crontab -e
and the press ENTER - Use the down arrow key to go to the bottom of the text
- Type
0 */4 * * * sudo reboot
- Press CTRL+X
- Press Y
- Press ENTER
If all went well, it should reboot every 4 hours, on the hour.

AnotherKiwiGuy
- 4,370
- 1
- 21
- 38
-
-
What user account? It would reboot the server using the root account, which should override every other user, regardless who is logged in. – AnotherKiwiGuy Dec 07 '16 at 08:55
-
@ThatGuy I think Giridhur is asking if after restart the log-in will be automatic. – Dec 07 '16 at 14:02
-
@tomas - I see. If it is using Ubuntu Server, then definitely not. It would be a potential security problem, no administrator wants their server to auto login. If it's Ubuntu Desktop, then it depends on how he configured it. – AnotherKiwiGuy Dec 07 '16 at 22:14
-
0 */4 * * * sudo reboot
? – AnotherKiwiGuy Dec 07 '16 at 08:29