11

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 3

7

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.

5
  • 4
    To 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.
    – Ouki
    Apr 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
    @AmgedRustom I do, thank you!
    – 4wk_
    Jun 30, 2021 at 12:50
  • DON'T DO THIS if you're connecting to the server REMOTELY via e.g. SSH!
    – DannyNiu
    Dec 18, 2021 at 0:03
3

Simply execute these two commands:

  1. init 1
  2. 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

1
  • DON'T DO THIS if you're connecting to the server REMOTELY via e.g. SSH!
    – DannyNiu
    Dec 18, 2021 at 0:03
0

To reload or restart network:

sudo service network restart or sudo /etc/init.d/network restart

To start networking service:

sudo service network start

5
  • 1
    Consider, It's not only networking service! Apr 8, 2014 at 7:03
  • 1
    and has nothing to do with Windows.
    – Ouki
    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
    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 scope
    – Ouki
    Apr 8, 2014 at 8:42
  • 1
    I think you do not answered the question 'Restart all services without reboot'
    – iuridiniz
    Jun 6, 2019 at 20:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .