94 lines
4.2 KiB
Bash
Executable File
94 lines
4.2 KiB
Bash
Executable File
#!/bin/sh
|
||
|
||
set -e
|
||
|
||
case "$1" in
|
||
configure)
|
||
# Setup logfile permissions:
|
||
if [ ! -e /var/log/monit.log ]
|
||
then
|
||
install -o root -g adm -m 0640 -Z /dev/null /var/log/monit.log
|
||
fi
|
||
|
||
# Add monit to /etc/aliases:
|
||
if [ -f /etc/aliases ] || [ -L /etc/aliases ]
|
||
then
|
||
if ! grep -qi '^monit[[:space:]]*:' /etc/aliases
|
||
then
|
||
echo "monit: root" >> /etc/aliases
|
||
test -x /usr/bin/newaliases && newaliases || :
|
||
fi
|
||
fi
|
||
;;
|
||
abort-upgrade|abort-remove|abort-deconfigure)
|
||
;;
|
||
*)
|
||
echo "postinst called with unknown argument \`$1'" >&2
|
||
exit 1
|
||
;;
|
||
esac
|
||
|
||
# Automatically added by dh_installdeb/13.14.1ubuntu5
|
||
dpkg-maintscript-helper mv_conffile /etc/monit/monitrc.d/acpid /etc/monit/conf-available/acpid 1:5.15-1\~ -- "$@"
|
||
dpkg-maintscript-helper mv_conffile /etc/monit/monitrc.d/apache2 /etc/monit/conf-available/apache2 1:5.15-1\~ -- "$@"
|
||
dpkg-maintscript-helper mv_conffile /etc/monit/monitrc.d/at /etc/monit/conf-available/at 1:5.15-1\~ -- "$@"
|
||
dpkg-maintscript-helper mv_conffile /etc/monit/monitrc.d/cron /etc/monit/conf-available/cron 1:5.15-1\~ -- "$@"
|
||
dpkg-maintscript-helper mv_conffile /etc/monit/monitrc.d/mdadm /etc/monit/conf-available/mdadm 1:5.15-1\~ -- "$@"
|
||
dpkg-maintscript-helper mv_conffile /etc/monit/monitrc.d/memcached /etc/monit/conf-available/memcached 1:5.15-1\~ -- "$@"
|
||
dpkg-maintscript-helper mv_conffile /etc/monit/monitrc.d/mysql /etc/monit/conf-available/mysql 1:5.15-1\~ -- "$@"
|
||
dpkg-maintscript-helper mv_conffile /etc/monit/monitrc.d/nginx /etc/monit/conf-available/nginx 1:5.15-1\~ -- "$@"
|
||
dpkg-maintscript-helper mv_conffile /etc/monit/monitrc.d/openntpd /etc/monit/conf-available/openntpd 1:5.15-1\~ -- "$@"
|
||
dpkg-maintscript-helper mv_conffile /etc/monit/monitrc.d/openssh-server /etc/monit/conf-available/openssh-server 1:5.15-1\~ -- "$@"
|
||
dpkg-maintscript-helper mv_conffile /etc/monit/monitrc.d/pdns-recursor /etc/monit/conf-available/pdns-recursor 1:5.15-1\~ -- "$@"
|
||
dpkg-maintscript-helper mv_conffile /etc/monit/monitrc.d/postfix /etc/monit/conf-available/postfix 1:5.15-1\~ -- "$@"
|
||
dpkg-maintscript-helper mv_conffile /etc/monit/monitrc.d/rsyslog /etc/monit/conf-available/rsyslog 1:5.15-1\~ -- "$@"
|
||
dpkg-maintscript-helper mv_conffile /etc/monit/monitrc.d/smartmontools /etc/monit/conf-available/smartmontools 1:5.15-1\~ -- "$@"
|
||
dpkg-maintscript-helper mv_conffile /etc/monit/monitrc.d/snmpd /etc/monit/conf-available/snmpd 1:5.15-1\~ -- "$@"
|
||
# End automatically added section
|
||
# Automatically added by dh_installinit/13.14.1ubuntu5
|
||
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
|
||
if [ -z "${DPKG_ROOT:-}" ] && [ -x "/etc/init.d/monit" ]; then
|
||
update-rc.d monit defaults >/dev/null
|
||
if [ -n "$2" ]; then
|
||
_dh_action=restart
|
||
else
|
||
_dh_action=start
|
||
fi
|
||
invoke-rc.d --skip-systemd-native monit $_dh_action || exit 1
|
||
fi
|
||
fi
|
||
# End automatically added section
|
||
# Automatically added by dh_installsystemd/13.14.1ubuntu5
|
||
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
|
||
# The following line should be removed in trixie or trixie+1
|
||
deb-systemd-helper unmask 'monit.service' >/dev/null || true
|
||
|
||
# was-enabled defaults to true, so new installations run enable.
|
||
if deb-systemd-helper --quiet was-enabled 'monit.service'; then
|
||
# Enables the unit on first installation, creates new
|
||
# symlinks on upgrades if the unit file has changed.
|
||
deb-systemd-helper enable 'monit.service' >/dev/null || true
|
||
else
|
||
# Update the statefile to add new symlinks (if any), which need to be
|
||
# cleaned up on purge. Also remove old symlinks.
|
||
deb-systemd-helper update-state 'monit.service' >/dev/null || true
|
||
fi
|
||
fi
|
||
# End automatically added section
|
||
# Automatically added by dh_installsystemd/13.14.1ubuntu5
|
||
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
|
||
if [ -d /run/systemd/system ]; then
|
||
systemctl --system daemon-reload >/dev/null || true
|
||
if [ -n "$2" ]; then
|
||
_dh_action=restart
|
||
else
|
||
_dh_action=start
|
||
fi
|
||
deb-systemd-invoke $_dh_action 'monit.service' >/dev/null || true
|
||
fi
|
||
fi
|
||
# End automatically added section
|
||
|
||
|
||
exit 0
|