Skip to content

Commit

Permalink
backup: remove unused env var and add netflow script
Browse files Browse the repository at this point in the history
  • Loading branch information
fichtner committed Apr 25, 2016
1 parent 84416c7 commit ce4bb4e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/etc/inc/upgrade_config.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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...";
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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()
Expand Down
3 changes: 3 additions & 0 deletions src/etc/rc
Original file line number Diff line number Diff line change
Expand Up @@ -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*
Expand Down
14 changes: 14 additions & 0 deletions src/etc/rc.backup_netflow
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions src/etc/rc.halt.common
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ce4bb4e

Please sign in to comment.