# Handle the incoming configuration files: config() { NEW="$1" OLD="`dirname $NEW`/`basename $NEW .new`" # If there's no config file by that name, mv it over: if [ ! -r $OLD ]; then mv $NEW $OLD elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then # toss the redundant copy rm $NEW fi # Otherwise, we leave the .new copy for the admin to consider... } # Check for munin account here if ! grep ^munin: /etc/group 2>&1 > /dev/null; then groupadd -g 301 munin fi if ! grep ^munin: /etc/passwd 2>&1 > /dev/null; then useradd -d /var/lib/munin -s /bin/bash -u 301 -g 301 -c "Munin" munin fi echo "==> Run the following to get a good set of default plugins:" echo " munin-node-configure --shell | sh" # Ensure directories exist mkdir -p /var/{lib,log}/munin /var/run/munin # Fix permissions on necessary directories chown munin.munin -R /var/{lib,log}/munin /var/run/munin config etc/munin/munin-node.conf.new