Naredba je neinteraktivna i moze se pokretati nakon instalacije novih
servisa. Receni program ce skopirati samo predloske za koje postoji
-odgovarajuci servis koji ispravno radi.
+odgovarajuci servis koji ispravno radi. Takodjer, naredba ce restartati
+monit servis ako je aktivan.
Za sljedece servise dolaze gotovi predlosci:
- amavisd.conf clamd.conf monitrc qpopper.conf thttpd.conf
- aosi.conf cron.conf mysqld.conf samba.conf tomcat5.conf
- apache1.conf dhcpd3.conf ntpd.conf sendmail.conf vsftpd.conf
- apache2.conf dovecot.conf openldap.conf sophie.conf
- bind8.conf exim.conf postfix.conf sshd.conf
- bind9.conf freeradius.conf proftpd.conf syslogd.conf
+ amavisd.conf bind9.conf freeradius.conf proftpd.conf syslogd.conf
+ aosi.conf clamd.conf mysqld.conf qpopper.conf thttpd.conf
+ apache1.conf cron.conf ntpd.conf samba.conf tomcat5.conf
+ apache2.conf dhcpd3.conf openldap.conf sendmail.conf vsftpd.conf
+ asterisk.conf dovecot.conf postfix.conf sophie.conf
+ bind8.conf exim.conf postgrey.conf sshd.conf
- -- Dinko Korunic <kreator@carnet.hr> at Mon, 24 Sep 2007 18:51:14 +0200
+Primijetite da je monit respawnable proces -- on ne starta kroz
+/etc/init.d/monit skripte (tzv. System V init skripte), vec kroz
+/etc/inittab pri cemu ima poseban status. U slucaju da monit proces
+"padne" ili ga nehotice netko "ubije", on ce se automatski odmah pokrenuti
+nazad.
+
+ -- Dinko Korunic <kreator@carnet.hr> at Thu, 25 Oct 2007 12:06:37 +0200
+monit-cn (1:4.5-2) stable; urgency=low
+
+ * dodan postgrey servis
+ * rijesen minorni problem sa mysql konfiguracijom (Monit iz Sargea nema
+ protocol mysql, pa cemo koristiti type tcp)
+ * workaround za monit SystemV skriptu -- registriramo se na pocetak init
+ skripte i javljamo da se koristi inittab
+
+ -- Dinko Korunic <kreator@carnet.hr> Thu, 25 Oct 2007 12:01:46 +0200
+
monit-cn (1:4.5-1) stable; urgency=low
* inicijalni paket sa skriptama za detekciju aktivnih servisa i generiranje
chmod u=rw,go= /etc/monit/monitrc
fi
-# generate monit.d files
-update-monit.d
+# (re)generate monit.d files
+update-monit.d || true
# disable monit startup
cp_check_and_sed '^startup=1/#startup=1/g' /etc/default/monit \
|| true
+# systemv part
+echo "CN: Disabling monit SystemV script"
+if [ -x "/etc/init.d/monit" ]; then
+ update-rc.d -f monit remove >/dev/null 2>&1
+ if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
+ invoke-rc.d monit stop || true
+ else
+ /etc/init.d/monit stop || true
+ fi
+fi
+if [ -e "/etc/init.d/monit" ]; then
+ if ! grep -q 'CARNet package monit-cn' /etc/init.d/monit; then
+ # shebang
+ head -n1 /etc/init.d/monit > /etc/init.d/monit.$$
+ # middle part
+ cp-update monit-cn /etc/init.d/monit.$$ <<EOF
+echo "CN: Monit SystemV init script disabled -- inittab is in use"
+echo "CN: Exiting now..."
+exit 0
+EOF
+ # rest of init script
+ tail -n+2 /etc/init.d/monit >> /etc/init.d/monit.$$
+ mv -f /etc/init.d/monit.$$ /etc/init.d/monit
+ chmod +x /etc/init.d/monit
+ fi
+fi
+
# install as inittab service
if ! grep -q '/usr/sbin/monit' /etc/inittab; then
- if [ -x "/etc/init.d/monit" ]; then
- update-rc.d -f monit remove >/dev/null 2>&1
- if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
- invoke-rc.d monit stop || true
- else
- /etc/init.d/monit stop || true
- fi
- fi
echo "CN: Installing monit service in /etc/inittab"
rm -f /etc/inittab.$$
cp /etc/inittab /etc/inittab.$$
fi
# reload init, since we have new configuration
-echo "CN: Starting monit service, please check /var/log/daemon.log"
+echo "CN: (Re)starting monit service, please check /var/log/daemon.log"
+pkill -9 -f /usr/sbin/monit || true
kill -HUP 1
# dh_installdeb will replace this with shell code automatically
echo "CN: Removing monit service from /etc/inittab"
cp-update -r monit-cn /etc/inittab
+# remove us from systemv monit script
+echo "CN: Removing monit workaround from /etc/init.d/monit"
+cp-update -r monit-cn /etc/init.d/monit
+chmod +x /etc/init.d/monit
+
# kill monit
echo "CN: Stopping monit service"
pkill -9 -f /usr/sbin/monit || true
--- /dev/null
+# asterisk monit-cn template
+
+check process asterisk with pidfile "/var/run/asterisk.pid"
+ start program = "/etc/init.d/asterisk start"
+ stop program = "/etc/init.d/asterisk stop"
check process mysql with pidfile "/var/run/mysqld/mysqld.pid"
start program = "/etc/init.d/mysql start"
stop program = "/etc/init.d/mysql stop"
- if failed host 127.0.0.1 port 3306 protocol mysql
+ #if failed host 127.0.0.1 port 3306 protocol mysql
+ # with timeout 10 seconds
+ # then restart
+ if failed host 127.0.0.1 port 3306 type tcp
with timeout 10 seconds
then restart
--- /dev/null
+# postgrey monit-cn template
+
+check process postgrey with pidfile "/var/run/postgrey.pid"
+ group mail
+ start program = "/etc/init.d/postgrey start"
+ stop program = "/etc/init.d/postgrey stop"
+ if failed host 127.0.0.1 port 60000 type tcp
+ then restart