OwlCyberSecurity - MANAGER
Edit File: cpanel-munin.postinst
#!/bin/sh set -e ## <asset scriplets/post> set -e USER=munin GROUP=munin PERL_BIN="/usr/local/cpanel/3rdparty/bin/perl536" PREFIX="/usr/local/cpanel/3rdparty/share/munin" PERL5LIB='' runPost() { action="$1" echo "Running runPost ${action}" if [ "x${USE_INITD}" = "x" ]; then # always reload the daemon /usr/bin/systemctl daemon-reload fi if [ -e /etc/munin/munin-node.conf.rpmsave ]; then echo "Moving munin-node.conf.rpmsave back into place in the event it was custom prior to this upgrade." /bin/mv /etc/munin/munin-node.conf.rpmsave /etc/munin/munin-node.conf ||: fi # munin need the wheel group to be available on the system /usr/bin/getent group wheel || ( echo "Adding 'wheel' group'"; /usr/sbin/addgroup --system wheel ) # this is going to build the conf && enable the service /usr/local/cpanel/bin/build_munin_conf ||: # Make sure yum.state exists and is munin-owned touch /var/lib/munin/plugin-state/yum.state chown ${USER}:${GROUP} /var/lib/munin/plugin-state/yum.state # Assure all files in docroot/munin are owned by munin. chown -R ${USER}:${GROUP} /usr/local/cpanel/whostmgr/docroot/munin/ # If we're a fresh install, the stats page will 404 until the first # run of the cron; let's run that now so there will be no 404s. if [ "${action}" = "install" ] ; then echo '- running munin-cron for the first time' PERL_PREFIX=$(${PERL_BIN} -MConfig -e 'print $Config{installprefix}') /bin/su -l -s /bin/bash -c "${PERL_PREFIX}/bin/munin-cron" munin >/dev/null 2>&1 ||: fi # Ensure proper permissions for these files/directories # so that /usr/local/cpanel/3rdparty/perl/536/bin/munin-check # does not throw warnings on them chmod 0644 /var/lib/munin/munin-graph.stats chmod 0775 /var/lib/munin/plugin-state chmod 0644 /var/lib/munin/datafile chmod 0644 /var/lib/munin/munin-update.stats # Register the plugin in WHM for installs and upgrades /usr/local/cpanel/bin/register_appconfig ${PREFIX}/munin_addon.conf ||: } runPostUninstall() { # unregister the plugin in WHM /usr/local/cpanel/bin/unregister_appconfig /var/cpanel/apps/munin_addon.conf ||: } ## </asset> case "$1" in configure) if [ "x$2" = "x" ]; then runPost install else runPost upgrade fi ;; triggered) /usr/local/cpanel/bin/build_munin_conf ||: ;; esac exit 0