Setting up a daily auto reboot time
Hi,
Since LFD seems to be finding changed files all the time due to updates, i would like to set up a automatic daily graceful reboot time. I believe this is done via cron but i will have to find some docs on that.
A question i have is: What if i reboot at 4am every day and some update such as cpanel or other related update is in progress at 4am also, does the update get killed even using graceful? I would prefer if the update finshed first, if there is a command option for that.
Thanks :)
Update: i did find an old topic from many years ago but i think it still works.
I added this to the bottom of the /var/spool/cron/root file
# added by dave
0 4 * * * /sbin/shutdown -r
-
I wanted to check to see if the restart happened but i do not have this log file
/usr/local/cpanel/logs/safeapacherestart_log does not exist. Is there a different log file?
0 -
How about this:
last reboot0 -
That works but my restart at 4am is not there. I suspect by looking at the other logs that there is alot going on at 4am, alot of backup stuff and alot of cpanel update app stuff, so i guess it got cancelled out. So maybe i will change the time to 7am
Question: why is this one from 2 hours ago still running, strange?
reboot system boot 4.18.0-553.51.1. Mon Jul 21 06:43 still running
reboot system boot 4.18.0-553.51.1. Sun Jul 20 13:12 - 06:42 (17:30)4.18.0-553.51.1. what does this mean?
0 -
That's the kernel version.
I've never seen a need for a daily reboot on a server - what specifically are you hoping to resolve by performing that reboot?
0 -
I seem to be getting the LFD mail every couple of days or every day that the MD5sum failed on certain files and im sure its via a valid update. If i dont reboot then i will get a email that the system is using outdated or old files so rather than have to log into the server every time, i just wanted to do a reboot daily. A server used to be "set it and forget it" kind of thing, but not anymore i guess. :)
0 -
Maybe this is something you should bring up with CSF/LFD instead of performing an unnecessary reboot on the system?
0 -
Ok thanks :)
0 -
I put:
7 15 * * * /sbin/shutdown -r nowin root crontab (i.e. couple of minutes later).
I was watching in root SSH when the server rebooted , and when I logged in I checked in /var/log/cron and saw this:
Jul 21 15:07:01 ns1 CROND[3096923]: (root) CMD (/sbin/shutdown -r now)Personally I don't want reboot servers unattended.
But if you do it you should not do it while backups are being done, or when cPanel/WHM is being updated.
In WHM -> Server Configuration -> Configure cPanel Cron Jobs you see what times upcp and backup are started.
0 -
Thanks quietFinn i have not yet contacted CSF but will soon. If they cant assist then ill refer back to your post, thanks so much for the info :)
0 -
Well seems posting to CSF forum is pretty much useless now days. In the past they used to atleast answer within a few days but looking at the tons of unanswered posts, it seems that has changed.
Oh well, since midnight to 6am seems to be really busy server time with other stuff i am going to try either 9am or 9am. That CSF LFD email is sent at midnight so if i reboot at 9am i can reboot after all the busy times pretty much right after, or 9pm ill have to depend on the old files for CSF LFD scanning till 9PM at night which is before it would run.
0 -
Well tested twice, even removed the #comment line to test that. Still no reboot logged so i give up, i will remove the code and i will just continue to log in and reboot manually, oh well i tried :)
Thanks for all the help everyone :)
0
Please sign in to leave a comment.
Comments
11 comments