sysvinit to systemctl cheat sheet - plembo/onemoretech GitHub Wiki

created: 2013/03/10 15:34:17

The SysVinit to Systemd Cheat sheet actually comes from our friends over at the Fedora Project as a way to ease transition from what was to what is in the world of controlling system services on Linux.

One thing that people need to keep in mind is that System V init scripts aren't going away any time soon. For most 3rd party software they'll remain de rigour until vendors have squeezed the very last ounce of profit from their existing offerings. In the case of open source projects the wait for systemctl versions of init scripts will probably be longer, just because.

That's not a real problem as long as administrators keep in mind that they actually should still run "chkconfig --list" to determine what legacy scripts may still need to be factored in. Here's the meat of the Fedora cheat sheet, with the httpd service substituted for the mythical "frobozz":

Sysvinit Command Systemd Command Notes

service httpd start 
systemctl start httpd.service

Used to start a service (not reboot persistent)

service httpd stop 
systemctl stop httpd.service 

Used to stop a service (not reboot persistent)

service httpd restart 
systemctl restart httpd.service 

Used to stop and then start a service

service httpd reload 
systemctl reload httpd.service 

When supported, reloads the config file without interrupting pending operations.

service httpd condrestart 
systemctl condrestart httpd.service

Restarts if the service is already running.

service httpd status 
systemctl status httpd.service 

Tells whether a service is currently running.

ls /etc/rc.d/init.d/ 
systemctl list-unit-files --type=service (preferred)  
ls /lib/systemd/system/*.service /etc/systemd/system/*.service

Used to list the services that can be started or stopped
Used to list all the services and other units

chkconfig httpd on 
systemctl enable httpd.service 

Turn the service on, for start at next boot, or other trigger.

chkconfig httpd off 
systemctl disable httpd.service 

Turn the service off for the next reboot, or any other trigger.

chkconfig httpd 
systemctl is-enabled httpd.service

Used to check whether a service is configured to start or not in the current environment.

chkconfig --list 
systemctl list-unit-files --type=service(preferred)  
ls /etc/systemd/system/*.wants/

Print a table of services that lists which runlevels each is configured on or off

chkconfig httpd --list 
ls /etc/systemd/system/*.wants/httpd.service 

Used to list what levels this service is configured on or off

chkconfig httpd --add 
systemctl daemon-reload 

Used when you create a new service file or modify any configuration

Copyright 2004-2019 Phil Lembo