mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
maintenance task
This commit is contained in:
@@ -32,6 +32,9 @@
|
||||
case 'setDeviceData': setDeviceData(); break;
|
||||
case 'deleteDevice': deleteDevice(); break;
|
||||
case 'deleteAllWithEmptyMACs': deleteAllWithEmptyMACs(); break;
|
||||
case 'createBackupDB': createBackupDB(); break;
|
||||
case 'restoreBackupDB': restoreBackupDB(); break;
|
||||
|
||||
|
||||
|
||||
case 'getDevicesTotals': getDevicesTotals(); break;
|
||||
@@ -195,6 +198,37 @@ function deleteAllWithEmptyMACs() {
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Create a DB backup
|
||||
//------------------------------------------------------------------------------
|
||||
function createBackupDB() {
|
||||
|
||||
//
|
||||
$result = copy("/home/pi/pialert/db/pialert.db","/home/pi/pialert/config/pialert.db_bak");
|
||||
// check result
|
||||
if ($result == TRUE) {
|
||||
echo "Copied successfully";
|
||||
} else {
|
||||
echo "Error copying DB. SSH into instance and copy manually.";
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Restore latest DB backup
|
||||
//------------------------------------------------------------------------------
|
||||
function restoreBackupDB() {
|
||||
|
||||
//
|
||||
$result = copy("/home/pi/pialert/config/pialert.db_bak", "/home/pi/pialert/db/pialert.db");
|
||||
// check result
|
||||
if ($result == TRUE) {
|
||||
echo "Copied successfully";
|
||||
} else {
|
||||
echo "Error copying DB. SSH into instance and copy manually.";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Query total numbers of Devices by status
|
||||
|
||||
Reference in New Issue
Block a user