[Linux] CentOSでサービスの起動・停止・状態の確認を行う方法

CentOS7では、サービスの起動などの方法が 「service start サービス名」から違う方式に変更されました。CentOS5との比較で記載します。
Contents
CentOS5でのコマンド
「httpd」を起動・停止・再起動・状態確認するには以前は以下のようにコマンドを打っていました。
1 2 3 4 |
# service start httpd # service stop httpd # service restart httpd # service status httpd |
試しにCentOS7で「」を打ってみると
1 |
The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl. |
というメッセージが返ってきます。「systemctl」を使ってくださいというメッセージが書かれています。
CentOS7でのコマンド
「systemctl」方式に変更になりました。
1 2 3 4 |
# systemctl start httpd # systemctl stop httpd # systemctl restart httpd # systemctl status httpd |
というコマンドになります。
関連記事
- [Linux] CentOSでApacheをインストールする方法
- [Apache] エラー対処方法 Job for httpd.service failed because the control process exited with error code
- [vsftpd] インストールとCentOSのfirewallの設定
- [CentOS] 特定のサービスの起動を確認・自動起動設定
- [CentOS] CentOS6.x KagoyaVPSの設定