Cron for reboot

you choose one,
or reboot
@reboot /path/to/script
or time
15 01 * * * /path/to/script
there is no combined version.
 
you choose one,
or reboot
@reboot /path/to/script
or time
15 01 * * * /path/to/script
there is no combined version.
1716982528513.png
thanks, i was thinking to place a cron in "all user cron jobs" section -
 
You can use crontab -e as root which works like the vi editor.
You can also use the /etc/crontab file, in that file is also some explanation of usage.

Edit: I would suggest using a script as suggested by @Zhenyapan in post #2, just to shutdown some services to be sure nothing gets crippled.
For example, shutdown DA, then shutdown mysql/mariadb and apache and maybe exim and the reboot command as last one in the script.
 
If it's one-time reboot at a specific time, why to use cron?
The sever, for unknown reasons, enters into high load, it ends up not responding at all. It should not do that, it worked well exactly as it is for 2 years. There is no traffic, no legit processes to cause that high load (500% CPU). After reboot, it stays normal for a while. I would like to reboot on daily basis until the issue is solved.
 
I would like to reboot on daily basis until the issue is solved.

Thank you for the reply. Why not. When I started my first Directadmin server I re-installed OS each time when a webserver went down and I had to restore users from backups. Would I do it now? - NO! Would I suggest that somebody do the same? - NO!

In your case, if you are shortage on a budget to hire somebody for an investigation, I would do install monit software or any other script, that monitors CPU load and restarts daemons, such as apache/php/mysql/nginx, if a server load hits 40+. I would never reboot a server with cron. Performing a reboot with cron one day you will find a server with boot> or grub> screen failed to start. It might be 1 fail per 100+ or even 300+ reboots, but still...

Beside that, I fully agree with Peter.
 
Performing a reboot with cron one day you will find a server with boot> or grub> screen failed to start. It might be 1 fail per 100+ or even 300+ reboots

Yes, I agree. (except you have remote KVM)
There are very few chance it failed to boot up as usual, also sometimes stuck at, e.g. BIOS process (e.g. press F1 to continue), fsck, emergency shell, etc.
 
Back
Top