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