With the release of Fedora15, systemd officially started to replace SysVinit. The Secret table in this article helps you easily transition from SysVinit to systemd. This document aims to help the system administrator understand the commands in systemd that can replace the original sysvinit workflow. For more information about systemd, see systemd. Note The 'service' and 'chkconfig' commands
With the release of Fedora 15, systemd officially started to replace SysVinit. The Secret table in this article helps you easily transition from SysVinit to systemd.
This document aims to help the system administrator understand the commands in systemd that can replace the original sysvinit workflow. For more information about systemd, see systemd.
Note that the 'service' and 'chkconfig' commands are still available in the systemd environment. This tutorial aims to show you how to use native systemctl alternatives.
Sysvinit command |
Systemd command |
Remarks |
Service frobozz start |
Systemctl start frobozz. service |
Used to start a service (does not restart the existing one) |
Service frobozz stop |
Systemctl stop frobozz. service |
It is used to stop a service (and does not restart the existing one ). |
Service frobozz restart |
Systemctl restart frobozz. service |
Used to stop and start a service. |
Service frobozz reload |
Systemctl reload frobozz. service |
If this feature is supported, reload the configuration file without interrupting the waiting operation. |
Service frobozz condrestart |
Systemctl condrestart frobozz. service |
If the service is running, restart it. |
Service frobozz status |
Systemctl status frobozz. service |
Report whether the service is running. |
Ls/etc/rc. d/init. d/ |
Ls/lib/systemd/system/*. service/etc/systemd/system/*. service |
List of services that can be started or stopped. |
Chkconfig frobozz on |
Systemctl enable frobozz. service |
Set service to enable at next startup or when other triggering conditions are met |
Chkconfig frobozz off |
Systemctl disable frobozz. service |
Set service to disabled at next startup or when other triggering conditions are met |
Chkconfig frobozz |
Systemctl is-enabled frobozz. service |
Used to check whether a service is enabled or disabled in the current environment. |
Chkconfig frobozz-list |
Ls/etc/systemd/system/*. wants/frobozz. service |
Used to list the running levels at which the service is enabled and disabled. |
Chkconfig frobozz-add |
|
No. There are no equivalent commands. |
Note that all the/sbin/service and/sbin/chkconfig listed above can still work in the systemd environment and will be translated as native equivalent commands if necessary. The only exception is chkconfig-list.
Additional commands:
- In SysVinit, the service can define any command. For exampleService iptables panicOrService httpd graceful. Native systemd Service does not have this capability.
- When writing native systemd service configurations, any service that defines additional commands in this way needs to define other, service-specific methods to complete this task.
- Check the release logs of the software package to learn about services that may perform similar operations.
Running level/target:
Systemd introduces a conceptTargetIts usage is similar to the running level, but it runs differently. EveryTargetNaming by name instead of number serves a specific purpose. Which serve a similar purpose as runlevels but act a little different. EachTargetIs named instead of numbered and is intended to serve a specific purpose. SomeTargetBy inheriting anotherTargetThen add other additional services for implementation. There are also some systemdTargetSimulate the common sysvinit running level, so you can still use the familiartelinit RUNLEVEL
To switchTarget. Run level 0, 1, 3, 5, and 6 on pure Fedora; with specificTargetThere is a ing between them. Unfortunately, similar conversions cannot be implemented for user-defined runtime Level 2 and Level 4. If you use these running levels, we recommend that you use/etc/systemd/system/$YOURTARGET
Create a new systemdTargetBased on an existing running level (you can view/lib/systemd/system/graphical.target
As an example), create a directory/etc/systemd/system/$YOURTARGET.wants
And then symbolic links to the extra services you want to enable to this directory (the services you symbolic links are located in/lib/systemd/system
).
Sysvinit running level |
Objective of systemd |
Remarks |
0 |
Runlevel0.target, poweroff.tar get |
Shut down the system. |
1, s, single |
Runlevel1.target, rescue.tar get |
Single User mode. |
2, 4 |
Runlevel2.target, runlevel4.target, multi-user.target |
User-Defined/specific domain running level. The default value is 3. |
3 |
Runlevel3.target, multi-user.target |
Multi-user, non-graphical. You can log on through multiple consoles or networks. |
5 |
Runlevel5.target, graphical.tar get |
Multi-user, graphical. Generally, all running level 3 services are added with graphical logon. |
6 |
Runlevel6.target, reboot.tar get |
Restart |
Emergency |
Emergency.tar get |
Emergency Shell |
Change the running level:
Sysvinit command |
Systemd command |
Remarks |
Telinit 3 |
Systemctl isolate multi-user.target (OR systemctl isolate runlevel3.target OR telinit 3) |
Change to multi-user running level. |
Sed s/^ id:. *: initdefault:/id: 3: initdefault :/ |
Ln-sf/lib/systemd/system/multi-user.target/etc/systemd/system/default.tar get |
Set the multi-user running level for the next startup. |