System

SysVinit and systemd command comparison table

Systemd components With the release of RHEL 7, users need to adapt to a different service manager: systemd replaces SysVinit. It offers several advantages, including parallel operation, mount point handling, and cgroups support. Since nearly all the commands have changed, I have provided tables comparing SysVinit and systemd so users can find the equivalents of familiar commands. *** The example service in these tables is named abc.

Service Command

Sysvinit CommandSystemd Command
Start service (does not configure startup at boot)service abc startsystemctl start abc
Stop service (does not configure stopping at boot)service abc stopsystemctl stop abc
Restart serviceservice abc restartsystemctl restart abc
Reload configuration without interrupting operation (if supported)service abc reloadsystemctl reload abc
Restart service if it is runningservice abc condrestartsystemctl condrestart abc
Check service statusservice abc statussystemctl status abc
List services in the system (which can be stopped or started)ls /etc/rc.d/init.d/systemctl or systemctl list-unit-files —type=servicels /lib/systemd/system/*.service /etc/systemd/system/*.service
Enable service at bootchkconfig abc onsystemctl enable abc
Disable service at bootchkconfig abc offsystemctl disable abc
Check whether service is enabled at boot in the current environmentchkconfig abcsystemctl is-enabled abc
Show a table of services enabled or disabled in each runlevelchkconfig —listsystemctl list-unit-files —type=service or ls /etc/systemd/system/*.wants/
List runlevels where the service is enabled or disabledchkconfig abc —listls /etc/systemd/system/*.wants/abc.service
Add a service file or change configurationchkconfig abc —addsystemctl daemon-reload

system log

SysvinitSystemd
Check system logstail /var/log/messages or tail /var/log/syslogjournalctl -f

Runlevels

SysvinitSystemd
System halt0runlevel0.target or poweroff.target
Single user mode1, s, singlerunlevel1.target or rescue.target
Multi user2runlevel2.target or multi-user.target
Multi user with Network3runlevel3.target or multi-user.target
Experimental4runlevel4.target or multi-user.target
Multi user with network and graphic5runlevel5.target or graphic.target
Reboot6runlevel6.target or reboot.target
Emergency shellemergencyemergency.target
Change runlevel/target to multi usertelinit 3systemctl isolate multi-user.target or systemctl isolate runlevel3.target
Set multi user runlevel/target for the next bootsed s/^id:*:initdefault:/id:3:initdefault:/ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
Check current runlevelrunlevelsystemctl get-default
Change current runlevelsed s/^id:*:initdefault:/id:3:initdefault:/systemctl set-default multi-user.target

Machine state

SysvinitSystemd
system halthaltsystemctl halt
Shut down (power off)poweroffsystemctl poweroff
Rebootrebootsystemctl reboot
Suspend systempm-suspendsystemctl suspend
Hibernatepm-hibernatesystemctl hibernate

Systemd new commands

Systemd
Run systemd command on a remote hostsystemctl abc.service start -H user@remotehost
Check boot timesystemd-analyze or systemd-analyze time
Kill every process associated with a servicesystemctl kill abc
Check today’s event logjournalctl —since=today
Manage hostnamehostnamectl
Manage date/time (including timezone)timedatectl
EOF.← Back to articles