3.7.4 Starting and Stopping Services

To start a service, use the systemctl command with the start argument, for example:

# systemctl start sshd

For legacy scripts in /etc/init.d that have not been ported as systemd services, you can run the script directly with the start argument:

# /etc/init.d/yum-cron start

To stop a service, use the stop argument to systemctl:

# systemctl stop sshd
Note

Changing the state of a service only lasts as long as the system remains at the same state. If you stop a service and then change the system-state target to one in which the service is configured to run (for example, by rebooting the system), the service restarts. Similarly, starting a service does not enable the service to start following a reboot. See Section 3.7.5, “Enabling and Disabling Services”.

systemctl supports the disable, enable, reload, restart, start, status, and stop actions for services. For other actions, you must either run the script that the service provides to support these actions, or for legacy scripts, the /etc/init.d script with the required action argument. For legacy scripts, omitting the argument to the script displays a usage message, for example:

# /etc/init.d/yum-cron
Usage: /etc/init.d/yum-cron {start|stop|status|restart|reload|force-reload|condrestart}

For more information, see the systemctl(1) manual page.