Restart services without rebooting server?

lambov

Member
Oct 9, 2016
21
0
51
Earth
cPanel Access Level
Root Administrator
i run cPanel Security Advisor and get this warning:
Code:
Detected 11 processes that are running outdated executables: 29474 29458 1942 27030 27036 27751 1 27802 28640 5208 28649
Reboot the server to ensure the system benefits from these updates.
Code:
[[email protected]~]# /usr/bin/needs-restarting
29474 : /usr/local/cpanel/3rdparty/bin/perl /usr/local/cpanel/3rdparty/attracta/scripts/daily_jobs.pl
29458 : /usr/sbin/CROND -n
27030 : /usr/sbin/CROND -n
27036 : /usr/local/cpanel/3rdparty/bin/perl /usr/local/cpanel/3rdparty/attracta/scripts/daily_jobs.pl
27751 : /usr/sbin/CROND -n
1 : /usr/lib/systemd/systemd --system --deserialize 21
27802 : /usr/local/cpanel/3rdparty/bin/perl /usr/local/cpanel/3rdparty/attracta/scripts/daily_jobs.pl
28640 : /usr/sbin/CROND -n
5208 : top -c
28649 : /usr/local/cpanel/3rdparty/bin/perl /usr/local/cpanel/3rdparty/attracta/scripts/daily_jobs.pl
how to restart them without reboot my server?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,245
463
Hello @lambov,

You can restart the individual services in most cases. For example, you can restart the crond service with the following command:

Code:
/scripts/restartsrv_crond
As far as the "systemd" service, you can reexecute the systemd manager with the following command:

Code:
systemctl daemon-reexec
There's a third-party URL discussing the need to restart systemd at:

Can I restart systemd without rebooting?

As for the remaining processes (perl and top), those processes can be killed manually if they are still running. EX:

Code:
ps aux|grep top
kill -9 $PID
Replace "$PID" with the process ID for top that's listed after running the ps command.

Note that a full reboot of the system is required in some cases. You can use the --reboothint flag if you're using CentOS 7 or higher to see if that's the case on your system. EX:

Code:
/usr/bin/needs-restarting --reboothint
Thank you.
 
Last edited:
  • Like
Reactions: linux4me2

LoadFactor

Well-Known Member
Jul 12, 2013
76
15
133
cPanel Access Level
Root Administrator
If I follow that external link, it tells me that

lsof -p1 | grep deleted : systemd

will tell me if systemd really needs to be restarted. For systems running KernelCare, it would be nice if WHM could determine that a restart is not actually required, and then not put up a big warning box that conveys the wrong information.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,245
463
If I follow that external link, it tells me that

lsof -p1 | grep deleted : systemd

will tell me if systemd really needs to be restarted. For systems running KernelCare, it would be nice if WHM could determine that a restart is not actually required, and then not put up a big warning box that conveys the wrong information.
Hello @LoadFactor,

While a reboot may not be required in every case, it's generally the safest and quickest approach to ensuring the server is not running outdated processes or executables. The alternative discussed on the StackOverflow link involves an advanced level of system administration knowledge and manual intervention. That said, I encourage you to open a feature request if you'd like to request a change or improvement to Security Advisor:

Submit A Feature Request

You can also see list of existing feature requests associated with Security Advisor at:

Search Results (8) - "Tag: Security Advisor" | cPanel & WHM Feature Requests

Thank you.
 

rpvw

Well-Known Member
Jul 18, 2013
1,101
466
113
UK
cPanel Access Level
Root Administrator
@cPanelMichael

Can you elaborate on the command you talked about earlier:
/usr/bin/needs-restarting --reboothint
I tried that on my Cloudlinux 6 box with cPanel 74.0.8 and got the following results:
Code:
# /usr/bin/needs-restarting --reboothint
Usage:
    needs-restarting: Report a list of process ids of programs that started
                    running before they or some component they use were updated.
needs-restarting: error: no such option: --reboothint
and a -h only lists:
Code:
# /usr/bin/needs-restarting -h
Usage:
    needs-restarting: Report a list of process ids of programs that started
                    running before they or some component they use were updated.
Options:
  -h, --help      show this help message and exit
  -u, --useronly  show processes for my userid only
Is the --reboothint from a future cPanel version or a different OS ?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,245
463
Is the --reboothint from a future cPanel version or a different OS ?
Hello @rpvw,

The needs-restarting binary is part of the operating system and not included with cPanel & WHM. The "--reboothint" flag is only supported on CentOS 7. I've edited my earlier post to reflect that information.

Thank you.