この記事は、CentOS7以降を対象としています。
CentOS6までは、SysV Initが利用されていましたが、CentOS7からはsystemdをになりました。
サービス一覧や停止や起動、自動起動設定などのコマンドが変更されたのでまとめてみました。
内容 | 旧 | 新 |
自動起動設定 | chkconfig サービス名 on | systemctl enable サービス名 |
自動起動を無効化 | chkconfig サービス名 off | systemctl disable サービス名 |
状態確認 | chkconfig --list | systemctl list-unit-files |
サービスの状態を表示する | service サービス名 status | systemctl status サービス名 |
サービスを起動する | service サービス名 start | systemctl start サービス名 |
サービスを停止する | service サービス名 stop | systemctl stop サービス名 |
サービスを再起動する | service サービス名 restart | systemctl restart サービス名 |
設定の再読み込み | service サービス名 reload | systemctl reload サービス名 |
serviceタイプのユニットは拡張子(.service)が省略可能。
systemctl start httpd.service → systemctl start httpd
systemctl list-dependencies サービス名
systemctl list-units
systemctl --type service
systemctl kill -s 9 サービス名
以上、chkconfigからsystemctlの対応の一覧でした。