Tuesday, April 21, 2015

How to control (start/stop/enable/disable) services using systemd in linux

This applies to system using systemd to control service such as Fedora, Ubuntu 15.04, Centos, Debian (later version)

systemctl     - > list all services
systemctl status mysqld   -> check mysqld service status
systemctl {start|stop|restart|enable|disable} mysqld    -> perform service control

systemctl mask mysqld    -> mysqld cannot be started even manually.  Have to unmask

systemctl is-enabled mysqld   -> check if mysqld is enabled


systemctl isolate {multi-user.target|runlevel3.target}   -> switch to run level 3
systemctl isolate {graphical.target|runlevel5.target}    -> switch to run level 5

systemctl set-default <name of target>.target    -> set default target
systemctl get-default                                           -> get current target

systemctl list-units --type=target      ->   list of all possible targets

For further info
man systemd
or https://fedoraproject.org/wiki/Systemd

No comments:

Post a Comment