mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
Add DB Backup to Maintenance fix
relative paths
This commit is contained in:
@@ -47,7 +47,7 @@ $execstring = 'ps -f -u pi | grep "nmap" 2>&1';
|
||||
$pia_nmapscans = "";
|
||||
exec($execstring, $pia_nmapscans);
|
||||
|
||||
$Pia_Archive_Path = "/home/pi/pialert/db/";
|
||||
$Pia_Archive_Path = str_replace('front', 'db', getcwd()).'/';
|
||||
$Pia_Archive_count = 0;
|
||||
$files = glob($Pia_Archive_Path . "*.zip");
|
||||
if ($files){
|
||||
|
||||
@@ -266,15 +266,16 @@ function deleteEvents() {
|
||||
//------------------------------------------------------------------------------
|
||||
function PiaBackupDBtoArchive() {
|
||||
|
||||
$file = '/home/pi/pialert/db/pialert.db';
|
||||
$newfile = '/home/pi/pialert/db/pialert.db.backup';
|
||||
// $DBFILE = '../../../db/pialert.db';
|
||||
$file = '../../../db/pialert.db';
|
||||
$newfile = '../../../db/pialert.db.backup';
|
||||
|
||||
if (!copy($file, $newfile)) {
|
||||
echo "Test Function executed not successfully";
|
||||
} else {
|
||||
$Pia_Archive_Name = 'pialertdb_'.date("Ymd_his").'.zip';
|
||||
$Pia_Archive_Path = '/home/pi/pialert/db/';
|
||||
exec('zip -j '.$Pia_Archive_Path.$Pia_Archive_Name.' /home/pi/pialert/db/pialert.db', $output);
|
||||
$Pia_Archive_Path = '../../../db/';
|
||||
exec('zip -j '.$Pia_Archive_Path.$Pia_Archive_Name.' ../../../db/pialert.db', $output);
|
||||
if (file_exists($Pia_Archive_Path.$Pia_Archive_Name)) {
|
||||
echo 'Test Function executed successfully ('.$Pia_Archive_Name.')';
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user