What is the difference between “systemctl restart” and “systemctl start”?
I have noticed that
-> "systemctl restart" command starts a service plus it also starts the dependent services
-> "systemctl start" command starts the service but it does not starts the dependent services
What is the difference between these 2 commands? Why is "systemctl start" not starting the dependent services as it is the case in "systemctl restart"
Take a look at the following scenario
I have two services A and B where A is dependent on B which means in the A's service unit i have After and Requires set to B
After=B.service
Requires=B.service
Now when i stop the service B the service A also stops. And then after stopping B when i start it, the service A is not started and i have to start it manually.
systemctl stop B (A is also stopped)
systemctl start B (A is not started)
systemctl start A (I have to start A manually)
But if the service A is already stopped and i restart service B then the B and A both are started by the systemctl
systemctl stop A
systemctl restart B (B and A both are started)
My question is what is difference between start and restart for the kind of service unit i have for A?
Responses
Hello
systemctl restart first stops the service and then starts it again, and it will also start it if it was not already running. This is described in Managing System Services. But that does not explain or account for what you are seeing. I wonder if you have been making some other changes and did not reload? In the section Creating Custom Unit Files the examples all use the reload command:
systemctl daemon-reload
Hello ,
"systemctl" is one of the mager future in RHEL 7. using "systemctl" we can control the services(daemons).
when you restarting the service , it should stop the service and then try start the service,during this time interval stoped service and all service relealted dependencies try start. but while starting, only the core service are started. bcoz all the dependencies are running state(while is not restarted) , if not dependencies also started.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
