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,cpuspeedand some others are is still up at init 1). But in Mohammad Etemaddar case it might be enough.Ouki– Ouki2014-04-08 07:21:23 +00:00Commented Apr 8, 2014 at 7:21 - A link explaining what are all those "init" value would have been great!4wk_– 4wk_2021-06-28 13:03:45 +00:00Commented 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#RunlevelsAmged Rustom– Amged Rustom2021-06-29 06:34:14 +00:00Commented Jun 29, 2021 at 6:34
- DON'T DO THIS if you're connecting to the server REMOTELY via e.g. SSH!DannyNiu– DannyNiu2021-12-18 00:03:30 +00:00Commented Dec 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!DannyNiu– DannyNiu2021-12-18 00:03:34 +00:00Commented Dec 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
- 1Consider, It's not only networking service!Mohammad Etemaddar– Mohammad Etemaddar2014-04-08 07:03:20 +00:00Commented Apr 8, 2014 at 7:03
- 1and has nothing to do with Windows.Ouki– Ouki2014-04-08 07:14:57 +00:00Commented Apr 8, 2014 at 7:14
- @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?les– les2014-04-08 08:09:10 +00:00Commented Apr 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 scopeOuki– Ouki2014-04-08 08:42:48 +00:00Commented Apr 8, 2014 at 8:42
- 1I think you do not answered the question 'Restart all services without reboot'iuridiniz– iuridiniz2019-06-06 20:46:35 +00:00Commented Jun 6, 2019 at 20:46