manatee-itの備忘ログ

プログラム初心者のブログ。ruby on railsでWebサービスを作成中。(仕事が忙しくなかななか進まず) つまずいた所をなんでも記録。 環境:Ruby2.1 + Rails4.1.1 + Passenger + CentOS6.4(Apache + sqlite/MySQL)

systemdメモ

■まえおき

自分が使うものだけメモ

■設定コマンド

/bin/systemctl

■設定ファイル

(1)パッケージに含まれる設定ファイル

/usr/lib/systemd/system/(サービス名).service

(2)修正を加える場合に先となるファイル

/etc/systemd/system/(サービス名).service
※(1)をコピーして編集、こちらが優先される

自動起動有効化した場合のシンボリックリンク作成先

/etc/systemd/system/multi-user.target.wants/httpd.service

自動起動設定 (httpdの場合)

自動起動有効化

# systemctl enable httpd.service

実行すると以下のメッセージの通り、シンボリックリンクが作成される
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

自動起動有効化解除

# systemctl disable httpd.service

自動起動設定一覧

# systemctl list-unit-files -t service

自動起動設定一覧(特定サービス)

# systemctl is-enabled httpd.service

■サービス起動停止 (httpdの場合)

起動

# systemctl start httpd.service

終了

# systemctl stop httpd.service

再起動

# systemctl restart httpd.service

確認

# systemctl status httpd.service