From 317811518be63939f7637b715ee95adcb28f7e2c Mon Sep 17 00:00:00 2001 From: Bas Couwenberg Date: Tue, 28 Dec 2010 14:28:48 -0600 Subject: network/nsca: Added (Nagios Service Check Acceptor) Signed-off-by: Robby Workman --- network/nsca/doinst.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 network/nsca/doinst.sh (limited to 'network/nsca/doinst.sh') diff --git a/network/nsca/doinst.sh b/network/nsca/doinst.sh new file mode 100644 index 0000000000..ecaa1a5ad0 --- /dev/null +++ b/network/nsca/doinst.sh @@ -0,0 +1,28 @@ +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... +} + +preserve_perms() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ -e $OLD ]; then + cp -a $OLD ${NEW}.incoming + cat $NEW > ${NEW}.incoming + mv ${NEW}.incoming $NEW + fi + config $NEW +} + +preserve_perms etc/rc.d/rc.nsca.new +config etc/nagios/nsca.cfg.new +config etc/nagios/send_nsca.cfg.new + -- cgit v1.2.3