Is there a safe time when to reboot server every morning?

Jare

Member
Sep 25, 2014
15
0
1
cPanel Access Level
Root Administrator
Hi,

I would like to restart my WHM server automatically every morning. I'm looking for a safe time window when this could be done without interfering with cPanel's scheduled processes. I think that the latest time to do the reboot would be at 7 AM, so I would accept anything between 2 AM to 7 AM if it suits for the cPanel processes. After that there could be more clients using the emails and websites during the morning.

Here is my current cron schedule (for the root user):

SHELL="/bin/bash"
0 6 * * * /usr/local/cpanel/scripts/exim_tidydb > /dev/null 2>&1

SHELL="/bin/bash"
30 5 * * * /usr/local/cpanel/scripts/optimize_eximstats > /dev/null 2>&1

SHELL="/bin/bash"
47 0 * * * /usr/local/cpanel/scripts/upcp --cron

SHELL="/bin/bash"
0 1 * * * /usr/local/cpanel/scripts/cpbackup

SHELL="/bin/bash"
0 2 * * * /usr/local/cpanel/bin/backup

SHELL="/bin/bash"
35 * * * * /usr/bin/test -x /usr/local/cpanel/bin/tail-check && /usr/local/cpanel/bin/tail-check

SHELL="/bin/bash"
45 */4 * * * /usr/bin/test -x /usr/local/cpanel/scripts/update_mailman_cache && /usr/local/cpanel/scripts/update_mailman_cache

SHELL="/bin/bash"
30 */4 * * * /usr/bin/test -x /usr/local/cpanel/scripts/update_db_cache && /usr/local/cpanel/scripts/update_db_cache

SHELL="/bin/bash"
30 */2 * * * /usr/local/cpanel/bin/mysqluserstore >/dev/null 2>&1

SHELL="/bin/bash"
15 */2 * * * /usr/local/cpanel/bin/dbindex >/dev/null 2>&1

SHELL="/bin/bash"
15 */6 * * * /usr/local/cpanel/scripts/autorepair recoverymgmt >/dev/null 2>&1

SHELL="/bin/bash"
*/5 * * * * /usr/local/cpanel/scripts/dcpumon-wrapper >/dev/null 2>&1

SHELL="/bin/bash"
8 21 * * * /usr/local/cpanel/whostmgr/docroot/cgi/cpaddons_report.pl --notify

SHELL="/bin/bash"
11,26,41,56 * * * * /usr/local/cpanel/whostmgr/bin/dnsqueue > /dev/null 2>&1

SHELL="/bin/bash"
46 22 * * * /usr/local/cpanel/3rdparty/bin/freshclam --quiet --no-warnings

SHELL="/bin/bash"
0 23 * * * /root/cron-update-composer.sh > /dev/null

SHELL="/bin/bash"
@reboot /usr/local/cpanel/bin/onboot_handler
09,39 * * * * /usr/local/cpanel/scripts/clean_user_php_sessions > /dev/null 2>&1
The only thing I have added myself is the composer update command.

Is there any other _system_ users whose cron schedule I should check? I know the user account schedules and they are not an issue, so I don't need to check those.

Background: My server's RAM usage raises to around 95 % every morning at around 1 AM or 2 AM. I have expanded the RAM from 4gb to 7 gb, but the RAM usage is still the same 95 % at max. I think that this does cause an issue where one of my clients is not able to get mail synced to their Outlooks on three computers at morning. They need to wait a few hours and then the sync goes well. My main priority is to inspect _why_ the RAM usage gets so high - and that is a different topic - but in this discussion I would like to search for a backup solution in case if I am not able to find a better, permanent solution soon. If I can get the RAM usage down with scheduled reboots, then I have more time to look what causes the issue in the first place. Thanks! :)
 

Eminds

Well-Known Member
Nov 10, 2016
319
34
28
India
cPanel Access Level
Root Administrator
Rebooting server to resolve the high memory issues is not the solution and by rebooting the server every day you are actually loosing the uptime. So instead of rebooting the server , you have to identify the issue on the server , whats eating up RAM etc... Optimize the server , tweak it , fine tuning the server will resolve the issues.
 

24x7server

Well-Known Member
Apr 17, 2013
1,912
99
78
India
cPanel Access Level
Root Administrator
Twitter
Hi,

Regarding the reboot, if you are concern about the cron, then you should go to the /var/spool/cron directory and look into the user's cron and analyze it. However, I think you should only check the main processes. The best for a reboot is to put the reboot schedule on the notice board, send in mails to the client updating them about the server downtime and reboot situation and then plan on it.

Regarding the RAM, you will have to either ask your system administrator to check the online application of the RAM or you need to reboot the server, so the actual RAM would be visible.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,270
463
Hello,

Ideally, you'd address the memory usage issue first instead of rebooting the system via a daily cron job. The following thread is a good place to start:

Troubleshooting high server loads on Linux servers

That said, to answer your question, the 4AM time slot looks open based on the times the default cron jobs run, but that's assuming your nightly backup process finishes in under two hours.

Thank you.