summaryrefslogtreecommitdiff
path: root/system/newrelic-sysmond/doinst.sh
diff options
context:
space:
mode:
authorSteven King <kingrst@gmail.com>2014-01-06 22:50:22 +0100
committerErik Hanson <erik@slackbuilds.org>2014-01-07 11:13:07 -0600
commit54de90f39a9ac05a1ee1288242b7eda5c84cae00 (patch)
tree7bd389c2c06d7379a4484bad80160cd78e4e548f /system/newrelic-sysmond/doinst.sh
parentdd9d44b2d0254e1021252dced6a72976458e60c3 (diff)
downloadslackbuilds-54de90f39a9ac05a1ee1288242b7eda5c84cae00.tar.gz
system/newrelic-sysmond: Added (server monitor application).
Signed-off-by: Matteo Bernardini <ponce@slackbuilds.org>
Diffstat (limited to 'system/newrelic-sysmond/doinst.sh')
-rw-r--r--system/newrelic-sysmond/doinst.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/system/newrelic-sysmond/doinst.sh b/system/newrelic-sysmond/doinst.sh
new file mode 100644
index 0000000000..447c1ab062
--- /dev/null
+++ b/system/newrelic-sysmond/doinst.sh
@@ -0,0 +1,26 @@
+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
+}
+
+config etc/newrelic/nrsysmond.cfg.new
+preserve_perms etc/rc.d/rc.nrsysmond.new