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 サービス名

トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2022-06-30 (木) 01:40:11