centos7
systemctlは、システムやサービスの起動・停止・再起動・確認などを行うサービス管理系コマンドです。
[root@centos7 ~]# systemctl
電源管理
# systemctl poweroff |
システムをシャットダウン |
# systemctl halt |
システムを停止 |
# systemctl reboot |
システムを再起動 |
サービス管理
# systemctl list-unit-files -t service |
サービス一覧 |
# systemctl start example |
サービス起動 |
# systemctl restart example |
サービス再起動 |
# systemctl reload example |
サービス再読み込み |
# systemctl kill -s 9 example |
サービス強制終了 |
# systemctl stop example |
サービス停止 |
# systemctl enable example |
サービス自動起動を有効 |
# systemctl disable example |
サービス自動起動を無効 |
# systemctl status example |
サービス詳細状態を表示 |
# systemctl is-enabled example |
サービスのシステム起動時の状態を表示 |
# systemctl is-active example |
サービス現時点の状態を表示 |
example of use
[root@centos7 ~]# systemctl status sshd
● sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
Active: active (running) since 水 2017-04-26 22:02:32 JST; 56min ago
Docs: man:sshd(8)
man:sshd_config(5)
Process: 1005 ExecStart=/usr/sbin/sshd $OPTIONS (code=exited, status=0/SUCCESS)
Main PID: 1717 (sshd)
CGroup: /system.slice/sshd.service
mq1717 /usr/sbin/sshd
4月 26 22:02:31 centos7 systemd[1]: Starting OpenSSH server daemon...
4月 26 22:02:32 centos7 sshd[1717]: Server listening on 0.0.0.0 port 22.
4月 26 22:02:32 centos7 sshd[1717]: Server listening on :: port 22.
4月 26 22:02:32 centos7 systemd[1]: Started OpenSSH server daemon.
4月 26 22:05:41 centos7 sshd[3708]: Accepted password for centos7 from 192.168.1.11 port 50508 ssh2