systemctl
サービスの自動起動†
一覧の確認†
# systemctl list-unit-files
サービスの自動起動の設定を確認する†
# systemctl list-unit-files postfix.service
UNIT FILE STATE
postfix.service enabled
1 unit files listed.
# systemctl list-unit-files amavisd.service
UNIT FILE STATE
amavisd.service disabled
1 unit files listed.
serviceのみ確認する†
# systemctl -t service
サービスの自動起動オン†
# systemctl enable ntpd
ln -s '/usr/lib/systemd/system/ntpd.service' '/etc/systemd/system/multi-user.target.wants/ntpd.service'
※リンク先のショートカットを削除すると、systemctl list-unit-filesではdisabledとなる。
※また、/etc/systemd/system/multi-user.target.wants/ からもシンボリックリンクが消えるので確認可能。
サービスの自動起動オフ†
# systemctl disable ntpd
rm '/etc/systemd/system/multi-user.target.wants/ntpd.service'
# systemctl list-unit-files | grep ntp
ntpd.service disabled
サービスの起動と停止†
# systemctl start サービス名
# systemctl stop サービス名