Linuxsystemctlコマンドの紹介

以下は、例としてsshdサービスを取り上げています。

systemctl enablesshd.service//起動時にsshdサービスを開始させます

systemctl disable sshd //ブートの開始を許可しませんが、.serviceを追加しません

systemctl statussshd//開始ステータスと停止ステータスを表示

systemctl stopsshd//サービスを停止します

systemctl startsshd//サービスを開始します

systemctl restartsshd//サービスを再起動します

systemctl is-enabledsshd//起動後にサービスが自動的に開始するかどうかを確認します

以下は有効になっていることを示しています。サービスは起動時に自己起動します

[root@localhost ~]# systemctl is-enabled sshd 
enabled

他のsystemctlの具体的な紹介については、Linuxでのsystemdサービスの紹介を参照してください。

おすすめ

転載: blog.csdn.net/qq_17576885/article/details/122707534