OwlCyberSecurity - MANAGER
Edit File: cpanel-munin.preinst
#!/bin/sh set -e ## <asset scriplets/pre> set -e SERVICE_NAME=munin-node.service PERL5LIB='' only_on_upgrade() { echo "- upgrading munin: stop previous version" # could use cpanel restartsrv script if [ "x${USE_INITD}" = "x1" ]; then if [ -e /etc/init.d/munin-node ]; then ( service munin-node status && service munin-node stop ) || : fi else /usr/bin/systemctl stop ${SERVICE_NAME} fi crontab -u munin -r || crontab -u munin /dev/null ||: } alway_run_on_pre() { echo "- checking munin user and group" # quota and permissions are (re)set even if the user exists with the force option if [ -x /usr/local/cpanel/scripts/addsystemuser ]; then /usr/local/cpanel/scripts/addsystemuser --login munin --owner munin:munin --permissions 0711 --force ||: fi # security ( backup plan ) /usr/sbin/groupadd munin ||: /usr/sbin/useradd -g munin munin ||: # Handle the situation where someone manaually RMs /home/munin, but left the munin user around mkdir -p ~munin ||: chmod 711 ~munin } # main entrance runPreUpgrade() { only_on_upgrade; alway_run_on_pre; } runPreInstall() { alway_run_on_pre; } runPreUninstall() { echo '- uninstalling munin' if [ "x${USE_INITD}" = "x" ]; then /usr/bin/systemctl stop ${SERVICE_NAME} /usr/bin/systemctl disable ${SERVICE_NAME} else ( service munin-node status && service munin-node stop ) ||: /sbin/chkconfig --del munin-node ||: fi crontab -u munin -r || crontab -u munin /dev/null ||: } ## </asset> case "$1" in install) runPreInstall; ;; upgrade) runPreUpgrade; ;; esac exit 0