2010-08-28 14:10:07 +02:00
|
|
|
config() {
|
2012-12-23 08:14:25 +01:00
|
|
|
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
|
2013-03-03 08:36:19 +01:00
|
|
|
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
|
|
|
|
# toss the redundant copy
|
2012-12-23 08:14:25 +01:00
|
|
|
rm $NEW
|
|
|
|
fi
|
|
|
|
# Otherwise, we leave the .new copy for the admin to consider...
|
2010-08-28 14:10:07 +02:00
|
|
|
}
|
|
|
|
|
2011-09-03 15:20:46 +02:00
|
|
|
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
|
|
|
|
}
|
2010-08-28 14:10:07 +02:00
|
|
|
|
2011-09-03 15:20:46 +02:00
|
|
|
preserve_perms etc/rc.d/rc.zabbix_proxy.new
|
2010-08-28 14:10:07 +02:00
|
|
|
config etc/zabbix/zabbix_proxy.conf.new
|
|
|
|
config var/log/zabbix/zabbix_proxy.log.new
|
|
|
|
rm -f var/log/zabbix/zabbix_proxy.log.new
|