r3: - new conffiles
authorDinko Korunic <Dinko.Korunic@CARNet.hr>
Wed, 3 Oct 2007 18:08:25 +0000 (18:08 +0000)
committerDinko Korunic <Dinko.Korunic@CARNet.hr>
Wed, 3 Oct 2007 18:08:25 +0000 (18:08 +0000)
- don't restart if there was no change in conffiles/status

12 files changed:
monit-cn/apache1.conf [new file with mode: 0644]
monit-cn/bind8.conf [new file with mode: 0644]
monit-cn/cron.conf [new file with mode: 0644]
monit-cn/exim.conf [new file with mode: 0644]
monit-cn/ntpd.conf [new file with mode: 0644]
monit-cn/proftpd.conf [new file with mode: 0644]
monit-cn/qpopper.conf [new file with mode: 0644]
monit-cn/samba.conf [new file with mode: 0644]
monit-cn/sendmail.conf [new file with mode: 0644]
monit-cn/sshd.conf [new file with mode: 0644]
monit-cn/syslogd.conf [new file with mode: 0644]
update-monit.d

diff --git a/monit-cn/apache1.conf b/monit-cn/apache1.conf
new file mode 100644 (file)
index 0000000..f2902d6
--- /dev/null
@@ -0,0 +1,9 @@
+# apache monit-cn template
+
+check process apache with pidfile "/var/run/apache.pid"
+       start program = "/etc/init.d/apache start"
+       stop program = "/etc/init.d/apache stop"
+       if failed host 127.0.0.1 port 80 protocol http
+               with timeout 15 seconds
+               then restart
+       if children > 250 then restart
diff --git a/monit-cn/bind8.conf b/monit-cn/bind8.conf
new file mode 100644 (file)
index 0000000..f324f53
--- /dev/null
@@ -0,0 +1,9 @@
+# bind8 monit-cn template
+
+check process bind with pidfile "/var/run/named.pid"
+       start program = "/etc/init.d/bind start"
+       stop program = "/etc/init.d/bind stop"
+       if failed host 127.0.0.1 port 53 type tcp
+               then restart
+       if failed host 127.0.0.1 port 53 type udp
+               then restart
diff --git a/monit-cn/cron.conf b/monit-cn/cron.conf
new file mode 100644 (file)
index 0000000..56753f2
--- /dev/null
@@ -0,0 +1,6 @@
+# crond monit-cn template
+
+check process cron with pidfile "/var/run/cron.pid"
+    group system
+    start program = "/etc/init.d/cron start"
+    stop program = "/etc/init.d/cron stop"
diff --git a/monit-cn/exim.conf b/monit-cn/exim.conf
new file mode 100644 (file)
index 0000000..35f256a
--- /dev/null
@@ -0,0 +1,8 @@
+# exim monit-cn template
+
+check process exim4 with pidfile "/var/run/exim4/exim.pid"
+       group mail
+       start program = "/etc/init.d/exim4 start"
+       stop program = "/etc/init.d/exim4 stop"
+       if failed host 127.0.0.1 port 25 protocol smtp
+               then restart
diff --git a/monit-cn/ntpd.conf b/monit-cn/ntpd.conf
new file mode 100644 (file)
index 0000000..48f4c25
--- /dev/null
@@ -0,0 +1,5 @@
+# ntp monit-cn template
+
+check process ntpd with pidfile "/var/run/ntpd.pid"
+    start program = "/etc/init.d/ntpd start"
+    stop program = "/etc/init.d/ntpd stop"
diff --git a/monit-cn/proftpd.conf b/monit-cn/proftpd.conf
new file mode 100644 (file)
index 0000000..d71f454
--- /dev/null
@@ -0,0 +1,5 @@
+# proftpd monit-cn template
+
+check process proftpd with pidfile "/var/run/proftpd.pid"
+    start program = "/etc/init.d/proftpd start"
+    stop program  = "/etc/init.d/proftpd stop"
diff --git a/monit-cn/qpopper.conf b/monit-cn/qpopper.conf
new file mode 100644 (file)
index 0000000..297df59
--- /dev/null
@@ -0,0 +1,8 @@
+# qpopper monit-cn template
+
+check process qpopper with pidfile "/var/run/popper.pid"
+       group mail
+       start program = "/etc/init.d/qpopper start"
+       stop program = "/etc/init.d/qpopper stop"
+       if failed host 127.0.0.1 port 110 type tcp
+               then restart
diff --git a/monit-cn/samba.conf b/monit-cn/samba.conf
new file mode 100644 (file)
index 0000000..9582278
--- /dev/null
@@ -0,0 +1,11 @@
+# samba monit-cn template
+
+check process smbd with pidfile "/var/run/samba/smbd.pid"
+       group system
+       start program = "/etc/init.d/samba start"
+       stop program = "/etc/init.d/samba stop"
+
+check process nmbd with pidfile "/var/run/samba/nmbd.pid"
+       group system
+       start program = "/etc/init.d/samba start"
+       stop program = "/etc/init.d/samba stop"
diff --git a/monit-cn/sendmail.conf b/monit-cn/sendmail.conf
new file mode 100644 (file)
index 0000000..5e8a186
--- /dev/null
@@ -0,0 +1,8 @@
+# sendmail monit-cn template
+
+check process sendmail with pidfile "/var/run/sendmail.pid"
+       group mail
+       start program = "/etc/init.d/sendmail start"
+       stop program = "/etc/init.d/sendmail stop"
+       if failed host 127.0.0.1 port 25 protocol smtp
+               then restart
diff --git a/monit-cn/sshd.conf b/monit-cn/sshd.conf
new file mode 100644 (file)
index 0000000..8ce1fe4
--- /dev/null
@@ -0,0 +1,8 @@
+# sshd monit-cn template
+
+check process sshd with pidfile "/var/run/sshd.pid"
+    start program  "/etc/init.d/ssh start"
+    stop program  "/etc/init.d/ssh stop"
+    if failed host 127.0.0.1 port 22 protocol ssh
+               with timeout 15 seconds
+        then restart
diff --git a/monit-cn/syslogd.conf b/monit-cn/syslogd.conf
new file mode 100644 (file)
index 0000000..5e368f4
--- /dev/null
@@ -0,0 +1,5 @@
+# syslogd monit-cn template
+
+check process syslogd with pidfile "/var/run/syslogd.pid"
+    start program = "/etc/init.d/sysklogd start"
+    stop program = "/etc/init.d/sysklogd stop"
index 0a1443f..0e06932 100755 (executable)
@@ -55,7 +55,9 @@ check_pid() {
     return 0
 }
 
+#####################################################################
 
+changed=0
 if [ ! -d "$MONIT_DIR" ]; then
     mkdir -p "$MONIT_DIR"
 else
@@ -65,6 +67,7 @@ else
             serviceconf=$(basename $i)
             echo "CN: Disabled $serviceconf"
             mv -f $i $i.disabled
+            changed=1
         fi
     done
 fi
@@ -76,11 +79,14 @@ for i in $(find "$TEMPLATES_DIR" -name '*.conf'); do
         if [ ! -r "$MONIT_DIR"/$serviceconf ]; then
             echo "CN: Enabled $serviceconf"
             cp -a $i "$MONIT_DIR"
+            changed=1
         fi
     fi
 done
 
-echo "CN: Stopping/restarting monit service"
-pkill -9 -f /usr/sbin/monit || true
+if [ $changed -eq 1 ]; then
+    echo "CN: Stopping/restarting monit service"
+    pkill -9 -f /usr/sbin/monit || true
+fi
 
 exit 0