Skip to content

Instantly share code, notes, and snippets.

@rothgar
Last active November 5, 2018 01:51
Show Gist options
  • Save rothgar/c9a6fef5708578061798 to your computer and use it in GitHub Desktop.
Save rothgar/c9a6fef5708578061798 to your computer and use it in GitHub Desktop.
Systemd vs SysVinit

Services

action sysvinit systemd
start service service foo start systemctl start foo[.service]
stop service service foo stop systemctl stop foo[.service]
restart service service foo restart systemctl restart foo[.service]
reload service service foo reload systemctl reload foo[.service]
service status service foo status systemctl status foo[.service]
restart if running service foo condrestart systemctl condrestart foo[.service]
enable service at startup chkconfig foo on systemctl enable foo[.service]
disable service at startup chkconfig foo off systemctl disable foo[.service]
check startup status chkconfig foo systemctl is-enabled foo[.service]
add or modify service file chkconfig foo --add systemctl daemon-reload

Runlevels

action sysvinit systemd
halt init (0,s[ingle]), halt runlevel0.target, poweroff.target, systemctl halt
single user init 1 runlevel1.target, rescue.target
multi user init 2 runlevel2.target, multi-user.target
multi user with network init 3 runlevel3.target, multi-user.target
experimental init 4 runlevel4.target, multi-user.target
multi user with network and graphics init 5 runlevel5.target, graphical.target
reboot init 6, reboot runlevel6.target, systemctl reboot
emergency shell grub emergency emergency.target
get current runlevel runlevel systemctl get-default
follow system log tail -f /var/log/(messages,syslog) journalctl -f

Misc

action systemd
execute command on remote host systemctl foo.service start -H user@host
check boot time systemd-analyze [time]
kill processes related to service systemctl kill foo
get logs for today journalctl --since=today
host info hostnamectl
time and date info timedatectl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment