Заметки сисадмина о интересных вещах из мира IT, инструкции и рецензии. Alt26.Alt16. Настраиваем Компьютеры/Сервера/1С/SIP-телефонию в Москве

Ubuntu: Schedule Reboot by using crontab

2025-03-11 · Posted in Linux Debian / Ubuntu

Install and run crontab:

Suppose you want to reboot the server at 6:05 am every day. Perform the following steps,
adjusting the details to fit your requirements:

►1) Use the following command to edit the crontab file:

Alternative Editors: You can set your preferred editor using the EDITOR environment variable. For example, to use nano, you can run: export EDITOR=nano before crontab -e

►2) To enter insert mode and add a new line at the end of the file, move the cursor to the last line and press the letter “o”.

►3) In the blank line, add the following line to the file to set the desired daily execution time and command to execute:

►4) Press “Esc” to exit insert mode and then enter “:wq” to save the file and quit crontab.

The following example shows the possible values for each element of a line in crontab.

Rebooting your server periodically might be a temporary fix. Troubleshoot the actual issue instead of
relying on a server re-boot to mask the issue.

►5) Use the following command to view the crontab:

Leave a Reply