Thursday, 17 March 2016

Managing the system with systemd

Systemd was introduced as a replacement for init - due to certain shortcomings like it's startup times and offer an improved API and lower memory footprint (I am not going to get into a pro's and con's argument - there are plenty of resources online that do this very well.)

Popular Linux distributions like Debian (8), Fedora and CentOS (7) have now adopted systemd as default.

The run-level concept (although now called 'targets' ) still applies and you are able to view the configuration for each level by running something like:

ls -l /usr/lib/systemd/system/runlevel*

Although these files are actually symbolic links pointing to the newly formatted names:

lrwxrwxrwx. 1 root root 15 Mar  8 15:13 /usr/lib/systemd/system/runlevel0.target -> poweroff.target
lrwxrwxrwx. 1 root root 13 Mar  8 15:13 /usr/lib/systemd/system/runlevel1.target -> rescue.target
lrwxrwxrwx. 1 root root 17 Mar  8 15:13 /usr/lib/systemd/system/runlevel2.target -> multi-user.target
lrwxrwxrwx. 1 root root 17 Mar  8 15:13 /usr/lib/systemd/system/runlevel3.target -> multi-user.target
lrwxrwxrwx. 1 root root 17 Mar  8 15:13 /usr/lib/systemd/system/runlevel4.target -> multi-user.target
lrwxrwxrwx. 1 root root 16 Mar  8 15:13 /usr/lib/systemd/system/runlevel5.target -> graphical.target
lrwxrwxrwx. 1 root root 13 Mar  8 15:13 /usr/lib/systemd/system/runlevel6.target -> reboot.target

You can switch to another runlevel (target)  with something like:

systemctl isolate runlevel7.target

and to get your current runlevel (target):

systemctl list-units --type target

and to change your default runlevel (target):

systemctl set-default graphical.target

We can get an overview of all of our services by issuing:

sudo systemctl

or check the status of a service with:

sudo systemctl status sshd


0 comments:

Post a comment