bug fix: scheduled backups

This commit is contained in:
Usman Nasir
2019-12-14 16:23:47 +05:00
parent 08cc518b1a
commit 0cc6a429f9
3 changed files with 23 additions and 1 deletions

View File

@@ -17,9 +17,11 @@ from plogical.processUtilities import ProcessUtilities
from random import randint
import json, requests
from datetime import datetime
import signal
class backupSchedule:
now = datetime.now()
@staticmethod
def remoteBackupLogging(fileName, message):
@@ -262,6 +264,14 @@ class backupSchedule:
def main():
backupSchedule.prepare()
def handler(signum, frame):
diff = datetime.now() - backupSchedule.now
logging.CyberCPLogFileWriter.writeToFile('Signal: %s, time spent: %s' % (str(signum), str(diff.total_seconds())))
if __name__ == "__main__":
for i in range(1,32):
if i == 9 or i == 19 or i == 32:
continue
signal.signal(i, handler)
main()

View File

@@ -4,9 +4,12 @@ import time
from backupSchedule import backupSchedule
from plogical.processUtilities import ProcessUtilities
from re import match,I,M
import signal
from datetime import datetime
class backupScheduleLocal:
localBackupPath = '/home/cyberpanel/localBackupPath'
now = datetime.now()
@staticmethod
def prepare():
@@ -62,5 +65,13 @@ def main():
backupScheduleLocal.prepare()
def handler(signum, frame):
diff = datetime.now() - backupScheduleLocal.now
logging.CyberCPLogFileWriter.writeToFile('Signal: %s, time spent: %s' % (str(signum), str(diff.total_seconds())))
if __name__ == "__main__":
for i in range(1,32):
if i == 9 or i == 19 or i == 32:
continue
signal.signal(i, handler)
main()

1
test.sh Normal file
View File

@@ -0,0 +1 @@