Init - jasper-zanjani/dotfiles GitHub Wiki
SystemVinit is a daemon process which was used by most distros until recently. Processes started serially and synchronously, wasting system resources; for years, a common hack was to run services in the background, simulating a sort of parallel processing. Upstart was developed by Canonical for Ubuntu, but abandoned in 2014.
SystemD was designed by a pair of Red Hat developers in 2010 to be a general purpose system manager.
It was intended to address multiple shortcomings with sysvinit.
It offers parallel execution, explicit dependencies between services, an escape from slow shell scripts, and per-daemon resource control and watchdogs.
SystemD introduces the concepts of [Units] which are subdivided into various unit types, each of which is associated with a filename extension. YouTube Linode
| [Targets][target] (SystemD) | Runlevels (System V Init) |
|---|---|
poweroff.target |
0 |
rescue.target |
1 |
multi-user.target |
3 |
graphical.target |
5 |
reboot.target |
6 |
emergency.target |
emergency |
SystemD searches for units from most specific to most general.
-
/usr/lib/systemd/systemdefault location where unit files are installed by packages -
/run/systemd/system: Runtime configuration -
/etc/systemd/systemtakes precedence over unit files located anywhere else
[SystemD][SystemD] components include:
- [
hostnamectl][hostnamectl] - [
journalctl][journalctl] - [
localectl][localectl] - [
loginctl][loginctl] - [
systemctl][systemctl] - [
systemd-delta][systemd-delta] - [
timedatectl][timedatectl]
Sysvinit
chkconfig
init
runlevel
service
telinit
Upstart
initctl
Permanently change hostname to $HOSTNAME
hostnamectl set-hostname $HOSTNAMEShow current disk usage of all journal files
journalctl --disk-usageContinuously update the display as new log entries are created
journalctl -fDisplay output in reverse (newest entries first)
journalctl -rChange locale to French
localectl set-locale LANG=fr_FR.utf8Control the systemd login manager
daemon-reload
disable
enable
get-default
isolate
kill
list-unit-files
list-units
mask
reboot
restart
set-default
start
status
stop
suspend
Configure iptables to start on boot and start it immediately
systemctl enable --now iptablesDisable $SERVICE, ensuring it does not run on boot
systemctl disable $SERVICEChange signal type sent to process to be killed
systemctl kill -sEquivalent to chkconfig --list
systemctl list-unit-files --type=servicePrevent firewalld from being started inadvertently by another process
systemctl mask firewalldRestart iptables.service
systemctl restart iptablesConfigure system to boot to a GUI
systemctl set-default graphical.targetStart $SERVICE
systemctl start $SERVICECheck status of $SERVICE
systemctl status $SERVICE
sudo systemctl is-active $SERVICETerminate $SERVICE
systemctl stop $SERVICEStop $SERVICE
systemctl stop $SERVICESuspend the system
systemctl suspendChange target to runlevel emergency
systemctl isolate emergency.targetShow files that are overridden with systemd
Display differences among files when they are overridden
systemd-delta --diffTurn services on or off for runlevels
Without arguments, chkconfig defaults to runlevels 3 or 5:
chkconfigDisplay all services and runlevels
chkconfig --listTurn {daemon} on for runlevels 3 and 5
chkconfig --level 35 daemon onTurn {daemon} off
chkconfig daemon off
chkconfig NetworkManager offTurn {daemon} service on
chkconfig daemon onAccess different runlevels
init Switch to runlevel {n}
init n
init 6 # rebootShow runlevel for system
runlevel Restart network service
service network restartCheck status of {daemon}
service daemon statusStop {daemon}
service daemon stop
service mongodb stopRefresh system after changes to /etc/inittab
telinit Cause operation to not send any notice to logged-on users
telinit--no-wallReload configuration files (on Upstart-controlled system)
initctl reload