#author("2020-11-04T05:46:32+00:00","default:src128","src128")
#author("2021-01-01T13:02:53+00:00","default:src128","src128")
&tag(swatch/CentOSの自動起動設定);
*目次 [#i30a25d9]
#contents
*関連ページ [#uad411c1]
*参考情報 [#g8f6503a]
-[[[RHEL7/CentOS7] ログ監視ツール swatch を入れてメール通知してみた - Qiita:https://qiita.com/fukuchan-senpai/items/ad5beb22baa657733d9b]]

*インストール [#eadcd26d]
-CentOS8の場合
 # dnf install swatch

*設定 [#x7df8f2e]

**設定ファイルの作成 [#ee3552a0]
-/etc/swatch.confを作成。
#pre{{
# logfile /var/log/httpd/access.log
watchfor /.*/
	 exec /home/hima/bin/myscript.rb '$_'
	 exec /home/tanaka/bin/myscript.rb '$_'
}}

**自動起動設定 [#f6be3b72]
-/lib/systemd/system/swatch.serviceを作成。
#pre{{
[Unit]
Description=swatch for test log

[Service]
ExecStart=/usr/bin/swatch -c /etc/swatch.conf -t /var/log/httpd/access.log --pid-file /var/run/swatch.pid --daemo
n > /dev/null 2>&1
Type=forking
PIDFile=/var/run/swatch.pid

[Install]
WantedBy=multi-user.target
}}
-有効化
 # systemctl daemon-reload
 # systemctl enable swatch
 # systemctl status swatch

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS