4 TEMPLATES_DIR=/usr/share/monit-cn
10 if [ ! -r "$filename" ]; then
15 script='BEGIN { RS = "[ \t\n]+" }
18 if (line[j] == "pidfile")
20 pidfiles=$(awk "$script" < "$filename" | sed -e 's/"//g')
21 check_pidfile $pidfiles
31 if [ $RET -eq 1 ]; then
48 if ! kill -0 "$1" >/dev/null 2>&1; then
58 #####################################################################
61 if [ ! -d "$MONIT_DIR" ]; then
64 for i in $(find "$MONIT_DIR" -name '*.conf'); do
66 if [ ! $RET -eq 0 ]; then
67 serviceconf=$(basename $i)
68 echo "CN: Disabled $serviceconf"
75 for i in $(find "$TEMPLATES_DIR" -name '*.conf'); do
77 if [ $RET -eq 0 ]; then
78 serviceconf=$(basename $i)
79 if [ ! -r "$MONIT_DIR"/$serviceconf ]; then
80 echo "CN: Enabled $serviceconf"
87 if [ $changed -eq 1 ]; then
88 echo "CN: Stopping/restarting monit service"
89 pkill -9 -f /usr/sbin/monit || true
91 echo "CN: No new services detected, sorry"