diff options
author | Lockywolf <for_sbo.ntopng_2023-11-20@lockywolf.net> | 2023-11-22 23:52:39 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2023-11-25 21:43:04 +0700 |
commit | 9936592c0cc914a95d48c5d27227f8b2b48aeb80 (patch) | |
tree | 26ede4c91511c00931eaafb7ce718511e32f166e /system/ntopng/doinst.sh | |
parent | 2ee487bf379f0650ff9b64d05159220fd08fb9f2 (diff) |
system/ntopng: Added (system monitoring).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/ntopng/doinst.sh')
-rw-r--r-- | system/ntopng/doinst.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/system/ntopng/doinst.sh b/system/ntopng/doinst.sh new file mode 100644 index 0000000000000..1250e7e18ce69 --- /dev/null +++ b/system/ntopng/doinst.sh @@ -0,0 +1,25 @@ +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.ntopng.new +config etc/logrotate.d/ntopng.new |