A guide to using systemd: Difference between revisions
Created page with "This is how to stop a running service temporarily: systemctl stop servicename.service This stops it from starting at boot, but does not stop a running service: systemctl di..." |
No edit summary |
||
Line 4: | Line 4: | ||
This stops it from starting at boot, but does not stop a running service: | This stops it from starting at boot, but does not stop a running service: | ||
systemctl disable servicename.service | systemctl disable servicename.service | ||
And there is one way to really really stop a service for good, short of uninstalling it, and that is masking it by linking it to /dev/null: | |||
ln -s /dev/null /etc/systemd/system/servicename.service | |||
systemctl daemon-reload | |||
When you do this you can't even start the service manually. Nothing can touch it. | |||
What if you change your mind? Pish tosh, it's easy. Simply delete the symlink and run | |||
systemctl enable servicename.service. | |||
While we're here, let's talk about two reload commands: daemon-reload and reload. The daemon-reload option reloads the entire systemd manager configuration without disrupting active services. reload reloads the configuration files for specific services without disrupting service, like this: | |||
systemctl reload servicename.service | |||
This reloads the actual configuration file used by the hardy sysadmin, for example the /etc/ssh/sshd_config file for an SSH server, and not its systemd unit file, sshd.service. So this is what to use when you make configuration changes. | |||
=booting= | |||
So what's taking so long? We can find out with the systemd-analyze blame command | |||
<pre>$ systemd-analyze blame | |||
60057ms sendmail.service | |||
51241ms firstboot-graphical.service | |||
3574ms sshd-keygen.service | |||
3439ms NetworkManager.service | |||
3101ms udev-settle.service | |||
3025ms netfs.service | |||
2411ms iptables.service | |||
2411ms ip6tables.service | |||
2173ms abrtd.service | |||
2149ms nfs-idmap.service | |||
2116ms systemd-logind.service | |||
2097ms avahi-daemon.service | |||
1337ms iscsi.service</pre> |
Revision as of 17:27, 26 January 2012
This is how to stop a running service temporarily:
systemctl stop servicename.service
This stops it from starting at boot, but does not stop a running service:
systemctl disable servicename.service
And there is one way to really really stop a service for good, short of uninstalling it, and that is masking it by linking it to /dev/null:
ln -s /dev/null /etc/systemd/system/servicename.service systemctl daemon-reload
When you do this you can't even start the service manually. Nothing can touch it.
What if you change your mind? Pish tosh, it's easy. Simply delete the symlink and run
systemctl enable servicename.service.
While we're here, let's talk about two reload commands: daemon-reload and reload. The daemon-reload option reloads the entire systemd manager configuration without disrupting active services. reload reloads the configuration files for specific services without disrupting service, like this:
systemctl reload servicename.service
This reloads the actual configuration file used by the hardy sysadmin, for example the /etc/ssh/sshd_config file for an SSH server, and not its systemd unit file, sshd.service. So this is what to use when you make configuration changes.
booting
So what's taking so long? We can find out with the systemd-analyze blame command
$ systemd-analyze blame 60057ms sendmail.service 51241ms firstboot-graphical.service 3574ms sshd-keygen.service 3439ms NetworkManager.service 3101ms udev-settle.service 3025ms netfs.service 2411ms iptables.service 2411ms ip6tables.service 2173ms abrtd.service 2149ms nfs-idmap.service 2116ms systemd-logind.service 2097ms avahi-daemon.service 1337ms iscsi.service