2017-12-20 14:37:20 +00:00
[#mapping-service-commands]
= Mapping service commands
2020-08-05 15:59:16 +00:00
The following table demonstrates the _systemd_ equivalent of SysVinit commands.
2017-12-20 14:37:20 +00:00
2020-08-05 15:59:16 +00:00
NOTE: All recent versions of `systemctl` assume the `.service` suffix if left off the service name. For example, `systemctl start frobozz.service` is the same as `systemctl start frobozz`.
2017-12-20 14:37:20 +00:00
[cols=",,",options="header",]
|===
2018-02-26 16:43:59 +00:00
|Sysvinit Command |systemd Command |Notes
2018-01-21 17:04:05 +00:00
|`service frobozz start`|`systemctl start frobozz`|Used to start a service (not reboot persistent)
2017-12-20 14:37:20 +00:00
2018-01-21 17:04:05 +00:00
|`service frobozz stop`|`systemctl stop frobozz`|Used to stop a service (not reboot persistent)
2017-12-20 14:37:20 +00:00
2018-01-21 17:04:05 +00:00
|`service frobozz restart`|`systemctl restart frobozz`|Used to stop and then start a service
2017-12-20 14:37:20 +00:00
2018-01-21 17:04:05 +00:00
|`service frobozz reload`|`systemctl reload frobozz`|When supported, reloads the config file without interrupting pending operations.
2017-12-20 14:37:20 +00:00
2018-01-21 17:04:05 +00:00
|`service frobozz condrestart`|`systemctl condrestart frobozz`|Restarts if the service is already running.
2017-12-20 14:37:20 +00:00
2018-01-21 17:04:05 +00:00
|`service frobozz status`|`systemctl status frobozz`|Tells whether a service is currently running.
2017-12-20 14:37:20 +00:00
2018-01-21 17:04:05 +00:00
|`ls /etc/rc.d/init.d/`|`systemctl` or `systemctl list-unit-files --type=service` or +
2020-08-05 20:48:09 +00:00
`ls /lib/systemd/system/\*.service /etc/systemd/system/*.service`|Used to list the services that can be started or stopped +
2017-12-20 14:37:20 +00:00
Used to list all the services and other units
2018-01-21 17:04:05 +00:00
|`chkconfig frobozz on`|`systemctl enable frobozz`|Turn the service on, for start at next boot, or other trigger.
2017-12-20 14:37:20 +00:00
2018-01-21 17:04:05 +00:00
|`chkconfig frobozz off`|`systemctl disable frobozz`|Turn the service off for the next reboot, or any other trigger.
2017-12-20 14:37:20 +00:00
2018-01-21 17:04:05 +00:00
|`chkconfig frobozz`|`systemctl is-enabled frobozz`|Used to check whether a service is configured to start or not in the current environment.
2017-12-20 14:37:20 +00:00
2018-01-21 17:04:05 +00:00
|`chkconfig --list`|`systemctl list-unit-files --type=service` or `ls /etc/systemd/system/*.wants/`|Print a table of services that lists which runlevels each is configured on or off
2017-12-20 14:37:20 +00:00
2018-01-21 17:04:05 +00:00
|`chkconfig --list \| grep 5:on`|`systemctl list-dependencies graphical.target`|Print a table of services that will be started when booting into graphical mode
2017-12-20 14:37:20 +00:00
2018-01-21 17:04:05 +00:00
|`chkconfig frobozz --list`|`ls /etc/systemd/system/*.wants/frobozz.service`|Used to list what levels this service is configured on or off
2017-12-20 14:37:20 +00:00
2018-01-21 17:04:05 +00:00
|`chkconfig frobozz --add`|`systemctl daemon-reload`|Used when you create a new service file or modify any configuration
2017-12-20 14:37:20 +00:00
|===
2020-08-05 15:59:16 +00:00
NOTE: All `/sbin/service` and `/sbin/chkconfig` commands listed in the table continue to work on _systemd_-based systems and are translated to native equivalents as necessary. The only exception is `chkconfig --list`.