# 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 nagios account here if ! grep ^nagios: /etc/group 2>&1 > /dev/null; then groupadd -g 213 nagios fi if ! grep ^nagios: /etc/passwd 2>&1 > /dev/null; then useradd -d /dev/null -s /bin/false -u 213 -g 213 -c "Nagios" nagios fi if [ -z "`grep ^nrpe /etc/services`" ]; then echo "nrpe 5666/tcp # nagios nrpe service" >> /etc/services fi if [ -z "`grep ^#:nrpe /etc/inetd.conf`" ]; then echo "" >> /etc/inetd.conf echo "#:nrpe" >> /etc/inetd.conf echo "#nrpe stream tcp nowait nagios /usr/sbin/nrpe nrpe -c /etc/nrpe/nrpe.cfg --inetd" >> /etc/inetd.conf fi config etc/nrpe/nrpe.cfg.new config etc/nrpe/conf.d/process_checks.cfg.new