mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-08 06:16:08 +01:00
bug fix: scheduled backups
This commit is contained in:
@@ -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()
|
||||
@@ -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()
|
||||
Reference in New Issue
Block a user