Skip to content

Instantly share code, notes, and snippets.

@jrelo
Last active May 10, 2016 22:58
Show Gist options
  • Save jrelo/c8b12b53c864adf3ba9803ec03f39ce9 to your computer and use it in GitHub Desktop.
Save jrelo/c8b12b53c864adf3ba9803ec03f39ce9 to your computer and use it in GitHub Desktop.
sysinitv -> systemd cheat sheet from fedoraproject.org
Sysvinit Command Systemd Command Notes
service frobozz start systemctl start frobozz Used to start a service (not reboot persistent)
service frobozz stop systemctl stop frobozz Used to stop a service (not reboot persistent)
service frobozz restart systemctl restart frobozz Used to stop and then start a service
service frobozz reload systemctl reload frobozz When supported, reloads the config file without interrupting pending operations.
service frobozz condrestart systemctl condrestart frobozz Restarts if the service is already running.
service frobozz status systemctl status frobozz Tells whether a service is currently running.
ls /etc/rc.d/init.d/ systemctl (or) systemctl list-unit-files --type=service (or) 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 frobozz on systemctl enable frobozz Turn the service on, for start at next boot, or other trigger.
chkconfig frobozz off systemctl disable frobozz Turn the service off for the next reboot, or any other trigger.
chkconfig frobozz systemctl is-enabled frobozz Used to check whether a service is configured to start or not in the current environment.
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
chkconfig frobozz --list ls /etc/systemd/system/*.wants/frobozz.service Used to list what levels this service is configured on or off
chkconfig frobozz --add systemctl daemon-reload Used when you create a new service file or modify any configuration.
Sysvinit Runlevel Systemd Target Notes
0 runlevel0.target, poweroff.target Halt the system.
1, s, single runlevel1.target, rescue.target Single user mode.
2, 4 runlevel2.target, runlevel4.target, multi-user.target User-defined/Site-specific runlevels. By default, identical to 3.
3 runlevel3.target, multi-user.target Multi-user, non-graphical. Users can usually login via multiple consoles or via the network.
5 runlevel5.target, graphical.target Multi-user, graphical. Usually has all the services of runlevel 3 plus a graphical login.
6 runlevel6.target, reboot.target Reboot
emergency emergency.target Emergency shell
Sysvinit Command Systemd Command Notes
telinit 3 systemctl isolate multi-user.target (OR systemctl isolate runlevel3.target OR telinit 3) Change to multi-user run level.
sed s/^id:.*:initdefault:/id:3:initdefault:/ ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target Set to use multi-user runlevel on next reboot.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment