# disable monit startup
cp_check_and_sed '^startup[[:space:]]*=[[:space:]]*1' \
- 's/^startup[[:space:]]*=.*/startup=0/g' /etc/default/monit || true
+ 's/^startup[[:space:]]*=.*/startup=1/g' /etc/default/monit || true
cp_check_and_sed '^START[[:space:]]*=[[:space:]]*yes' \
- 's/^START[[:space:]]*=.*/START=no/g' /etc/default/monit || true
-
-# systemv part
-if ! grep -q 'CARNet package monit-cn' /etc/init.d/monit; then
- 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
- # 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
+ 's/^START[[:space:]]*=.*/START=yes/g' /etc/default/monit || true
-# if old inittab is referencing sbin, fix it
-if grep -q '/usr/sbin/monit' /etc/inittab; then
- cp_check_and_sed '/usr/sbin/monit' \
- 's:/usr/sbin/monit:/usr/bin/monit:g' \
- /etc/inittab || true
+# remove us from systemv monit script
+if grep -q 'CARNet package monit-cn' /etc/init.d/monit; then
+ echo "CN: Removing monit workaround from /etc/init.d/monit -- systemd is in use"
+ cp-update -r monit-cn /etc/init.d/monit
+ chmod +x /etc/init.d/monit
fi
-# install as inittab service
-if ! grep -q '/usr/bin/monit' /etc/inittab; then
- echo "CN: Installing monit service in /etc/inittab"
- cp -a /etc/inittab /etc/inittab.$$
- cp-update monit-cn /etc/inittab.$$ <<EOF
-mo:2345:respawn:/usr/bin/monit -Ic /etc/monit/monitrc
-m0:06:wait:/usr/bin/monit -Ic /etc/monit/monitrc stop myprocess
-EOF
- cp_mv /etc/inittab.$$ /etc/inittab
-fi
-
-# reload init, since we have new configuration
-echo "CN: (Re)starting monit service, please check /var/log/daemon.log"
-pkill -9 -f '/usr/bin/monit$' || true
-telinit q
+service monit restart
+
+## systemv part
+#if ! grep -q 'CARNet package monit-cn' /etc/init.d/monit; then
+# 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
+# # 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
+#
+## if old inittab is referencing sbin, fix it
+#if grep -q '/usr/sbin/monit' /etc/inittab; then
+# cp_check_and_sed '/usr/sbin/monit' \
+# 's:/usr/sbin/monit:/usr/bin/monit:g' \
+# /etc/inittab || true
+#fi
+#
+## install as inittab service
+#if ! grep -q '/usr/bin/monit' /etc/inittab; then
+# echo "CN: Installing monit service in /etc/inittab"
+# cp -a /etc/inittab /etc/inittab.$$
+# cp-update monit-cn /etc/inittab.$$ <<EOF
+#mo:2345:respawn:/usr/bin/monit -Ic /etc/monit/monitrc
+#m0:06:wait:/usr/bin/monit -Ic /etc/monit/monitrc stop myprocess
+#EOF
+# cp_mv /etc/inittab.$$ /etc/inittab
+#fi
+#
+## reload init, since we have new configuration
+#echo "CN: (Re)starting monit service, please check /var/log/daemon.log"
+#pkill -9 -f '/usr/bin/monit$' || true
+#telinit q
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
;;
esac
-# import CN-functions
-. /usr/share/carnet-tools/functions.sh
-
-# remove us from inittab
-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/bin/monit || true
-
-# reload init
-telinit q
+## import CN-functions
+#. /usr/share/carnet-tools/functions.sh
+#
+## remove us from inittab
+#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/bin/monit || true
+#
+## reload init
+#telinit q
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.