「systemctl」コマンドの覚書!! | Ohjiro's Note

Ohjiro's Note

<オージロウの奮闘ノート> これはオージロウが奮闘した日々の大切な記録です。

「systemctl」コマンドの覚書です。RHEL7から「systemd」が導入されて基本コマンドに変更がありました。結構、ベーシックなコマンドの変更なので、覚えるのが大変ですね。

「systemctl」コマンド(停止/開始/再読込/ステータス)


<サービス停止>
/etc/init.d/httpd stop
systemctl stop httpd.service

<サービス起動>
/etc/init.d/httpd start
systemctl start httpd.service

<サービス再起動>
/etc/init.d/httpd restart
systemctl restart httpd.service

<設定ファイル再読込>
/etc/init.d/httpd reload
systemctl reload httpd.service

<ステータス>
/etc/init.d/httpd status
systemctl status httpd.service

「systemctl」コマンド(一覧表示/強制終了)


<サービス一覧>
chkconfig --list
systemctl list-unit-files

<強制終了>
pkill -9 httpd
systemctl kill -s9 httpd.service

「systemctl」コマンド(起動設定/無効化/有効化)


<起動設定/起動>
chkconfig --level 345 httpd on
systemctl enable httpd.service

<起動設定/停止>
chkconfig httpd off
systemctl disable httpd.service

<無効化>
chkconfig --del httpd
systemctl mask httpd.service

<有効化>
chkconfig --add httpd
systemctl unmask httpd.service

これを機会に「systemd」をマスターしますよ!!<つづく>