backup: remove unused env var and add netflow script

This commit is contained in:
Franco Fichtner 2016-04-25 10:32:28 +02:00
parent 84416c7187
commit ce4bb4e7a6
4 changed files with 21 additions and 4 deletions

View File

@ -2125,8 +2125,7 @@ function upgrade_054_to_055()
enable_rrd_graphing();
/* Let's save the RRD graphs after we run enable RRD graphing */
/* The function will restore the rrd.tgz so we will save it after */
exec("cd /; LANG=C NO_REMOUNT=1 RRDDBPATH='{$rrddbpath}' CF_CONF_PATH='/conf' /usr/local/etc/rc.backup_rrd");
mwexec('/bin/rm /var/db/rrd/*.xml');
exec("cd /; LANG=C RRDDBPATH='{$rrddbpath}' CF_CONF_PATH='/conf' /usr/local/etc/rc.backup_rrd");
if (file_exists("/var/run/booting")) {
echo "Updating configuration...";
}
@ -2790,7 +2789,7 @@ function upgrade_080_to_081()
enable_rrd_graphing();
/* Let's save the RRD graphs after we run enable RRD graphing */
/* The function will restore the rrd.tgz so we will save it after */
exec("cd /; LANG=C NO_REMOUNT=1 RRDDBPATH='{$rrddbpath}' CF_CONF_PATH='/conf' /usr/local/etc/rc.backup_rrd");
exec("cd /; LANG=C RRDDBPATH='{$rrddbpath}' CF_CONF_PATH='/conf' /usr/local/etc/rc.backup_rrd");
if (file_exists("/var/run/booting"))
echo "Updating configuration...";
foreach($config['filter']['rule'] as & $rule) {
@ -3096,7 +3095,7 @@ function upgrade_095_to_096()
enable_rrd_graphing();
/* Let's save the RRD graphs after we run enable RRD graphing */
/* The function will restore the rrd.tgz so we will save it after */
exec("cd /; LANG=C NO_REMOUNT=1 RRDDBPATH='{$rrddbpath}' CF_CONF_PATH='/conf' /usr/local/etc/rc.backup_rrd");
exec("cd /; LANG=C RRDDBPATH='{$rrddbpath}' CF_CONF_PATH='/conf' /usr/local/etc/rc.backup_rrd");
}
function upgrade_096_to_097()

View File

@ -184,6 +184,9 @@ echo "done."
# Execute the early syshook / plugin commands
/usr/local/etc/rc.syshook early
# Restore backups from previous shutdown (if any)
/usr/local/etc/rc.backup_netflow restore
# let the PHP-based configuration subsystem set up the system now
echo -n "Launching the init system..."
rm -f /root/lighttpd*

14
src/etc/rc.backup_netflow Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
BACKUPFILE="/conf/netflow.tgz"
BACKUPDIR="/var/netflow"
if [ "${1}" == "restore" ]; then
if [ -f "${BACKUPFILE}" ]; then
tar -C / -xzf "${BACKUPFILE}"
fi
else
if [ -d "${BACKUPDIR}" ]; then
tar -C / -czf "${BACKUPFILE}" "${BACKUPDIR}"
fi
fi

View File

@ -11,6 +11,7 @@
# backup volatile internals
/usr/local/etc/rc.backup_dhcpleases
/usr/local/etc/rc.backup_netflow
/usr/local/etc/rc.backup_rrd
# wait for config lock to release