I do some group permission changes on the CentOS server, And then need restart all services. How can I restart all services safely without rebooting?
3 Answers
You could switch to single user mode as SHW suggested and then back again. But for CentOS server you should do it this way:
init 1; init 3
Since the first command will disable your network, you should pass the second one on the same line. Otherwise you will not be able to connect to your server using SSH.
-
4To really restart ALL services, you had to go a bit further (ie
udev
,cpuspeed
and some others are is still up at init 1). But in Mohammad Etemaddar case it might be enough.– OukiApr 8, 2014 at 7:21 -
A link explaining what are all those "init" value would have been great!– 4wk_Jun 28, 2021 at 13:03
-
1@4wk_ this question was pre systemd. If you would still like to know more you might find this page useful: wiki.archlinux.org/title/SysVinit#Runlevels Jun 29, 2021 at 6:34
-
1
-
DON'T DO THIS if you're connecting to the server REMOTELY via e.g. SSH!– DannyNiuDec 18, 2021 at 0:03
Simply execute these two commands:
- init 1
- init 5
Init 1 will bring your computer to single user mode, where minimal services are running, and init 5 will being the system back to GUI mode, by restarting all the services
-
DON'T DO THIS if you're connecting to the server REMOTELY via e.g. SSH!– DannyNiuDec 18, 2021 at 0:03
To reload or restart network:
sudo service network restart
or sudo /etc/init.d/network restart
To start networking service:
sudo service network start
-
1
-
1
-
@Ouki I edited my answer; however, questions are not supposed to be specific to one persons situation. If the answer comes easy enough to cover multiple situations (OS's) then it is simply more thorough. Agreed?– lesApr 8, 2014 at 8:09
-
@les I agree that answer need to be a bit broader than the questions, but you should at least answer to it. Your answer was only about network restart and it involved Windows as well ... totally out of the scope– OukiApr 8, 2014 at 8:42
-
1I think you do not answered the question 'Restart all services without reboot' Jun 6, 2019 at 20:46