systemd is a system and service manager for Linux, compatible with SysV and LSB init scripts. systemd provides aggressive parallelization capabilities, uses socket and D-Bus activation for starting services, offers on-demand starting of daemons, keeps track of processes using Linux control groups, supports snapshotting and restoring of the system state, maintains mount and automount points and implements an elaborate transactional dependency-based service control logic.

A crash course

With systemd we have a /etc/systemd/system/ directory chock-full of symlinks to files in /lib/systemd/system/. /lib/systemd/system/ contains init scripts; to start a service at boot it must be linked to /etc/systemd/system/. The systemctl command does this for you when you enable a new service.


# systemctl start [name.service]
# systemctl stop [name.service]
# systemctl restart [name.service]
# systemctl reload [name.service]
# systemctl status [name.service]
# systemctl is-active [name.service]
# systemctl list-units --type service --all
# systemctl enable ntpd.service
# systemctl disable ntpd.service

Useful stuff:

Check the services


Check the services that failed

systemctl --failed

Check how much time each service takes:

systemd-analyze blame

A simple example

First create the script that will be launched by the service:

touch test
cat << _EOF_ >
echo "test: $(date)" >> /home/ubuntu/test

Now we create the service file:

cat << _EOF_ > /lib/systemd/system/test.service
Description=A test service for demo purposes



We test that the service works:

systemctl start test.service

Finally we enable the service so that it starts at boot time

systemctl enable test.service
systemd-analyze plot > test.svg

produces something like:


results matching ""

    No results matching ""