maintenance task DB

This commit is contained in:
jokob-sk
2022-01-14 16:31:58 +11:00
parent b008017174
commit 903478524c
4 changed files with 4 additions and 198 deletions

View File

@@ -219,76 +219,6 @@ function deleteAllDevices() {
}
}
//------------------------------------------------------------------------------
// Run scan 1 min now
//------------------------------------------------------------------------------
function runScan1min() {
$command = escapeshellcmd('/home/pi/pialert/back/pialert.py 1');
$output = shell_exec($command);
echo $output;
}
//------------------------------------------------------------------------------
// Run scan 15 min now
//------------------------------------------------------------------------------
function runScan15min() {
$command = escapeshellcmd('/home/pi/pialert/back/pialert.py 15');
$output = shell_exec($command);
echo $output;
}
//------------------------------------------------------------------------------
// 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.";
// }
$mystring = system('python /home/pi/pialert/back/maintenance.py backup_db', $retval);
// $command = escapeshellcmd('/home/pi/pialert/back/maintenance.py backup_DB');
// $output = shell_exec($command);
//echo $output;
echo $retval;
}
//------------------------------------------------------------------------------
// 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.";
// }
$command = escapeshellcmd('/home/pi/pialert/back/maintenance.py restore_db');
$output = shell_exec($command);
echo $output;
}
//------------------------------------------------------------------------------