diff --git a/etc/inc/upgrade_config.inc b/etc/inc/upgrade_config.inc index 00dc349118..ea18c9604c 100644 --- a/etc/inc/upgrade_config.inc +++ b/etc/inc/upgrade_config.inc @@ -1936,6 +1936,17 @@ function upgrade_054_to_055() { $rrddbpath = "/var/db/rrd/"; $rrdtool = "/usr/bin/nice -n20 /usr/local/bin/rrdtool"; + if ($g['platform'] != "pfSense") { + /* restore the databases, if we have one */ + if (file_exists("{$g['cf_conf_path']}/rrd.tgz")) { + exec("cd /;LANG=C /usr/bin/tar -xzf {$g['cf_conf_path']}/rrd.tgz 2>&1", $rrdrestore, $rrdreturn); $rrdrestore = implode(" ", $rrdrestore); + if($rrdreturn <> 0) { + log_error("RRD restore failed exited with $rrdreturn, the error is: $rrdrestore\n"); + } + /* Make sure to move the rrd backup out of the way. We will make a new one after converting. */ + exec("/bin/mv {$g['cf_conf_path']}/rrd.tgz /root/"); + } + } $rrdinterval = 60; $valid = $rrdinterval * 2; @@ -2049,6 +2060,9 @@ 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 /usr/bin/tar -czf {$g['cf_conf_path']}/rrd.tgz -C / var/db/rrd/*.rrd"); if ($g['booting']) echo "Updating configuration..."; }