mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
maintenance task DB
This commit is contained in:
23
back/maintenance.py
Normal file
23
back/maintenance.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import sys
|
||||
import shutil
|
||||
|
||||
|
||||
def main ():
|
||||
|
||||
argument = str(sys.argv[1])
|
||||
|
||||
## Main Commands
|
||||
if argument == 'backup_db':
|
||||
res = backup_db()
|
||||
|
||||
if argument == 'restore_db':
|
||||
res = restore_db()
|
||||
|
||||
def backup_db ():
|
||||
# Header
|
||||
shutil.copyfile("/home/pi/pialert/db/pialert.db", "/home/pi/pialert/config/pialert.db_bak")
|
||||
|
||||
|
||||
def restore_db ():
|
||||
# Header
|
||||
shutil.copyfile("/home/pi/pialert/config/pialert.db_bak", "/home/pi/pialert/db/pialert.db")
|
||||
Reference in New Issue
Block a user