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
|
from random import randint
|
||||||
import json, requests
|
import json, requests
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
import signal
|
||||||
|
|
||||||
|
|
||||||
class backupSchedule:
|
class backupSchedule:
|
||||||
|
now = datetime.now()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def remoteBackupLogging(fileName, message):
|
def remoteBackupLogging(fileName, message):
|
||||||
@@ -262,6 +264,14 @@ class backupSchedule:
|
|||||||
def main():
|
def main():
|
||||||
backupSchedule.prepare()
|
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__":
|
if __name__ == "__main__":
|
||||||
|
for i in range(1,32):
|
||||||
|
if i == 9 or i == 19 or i == 32:
|
||||||
|
continue
|
||||||
|
signal.signal(i, handler)
|
||||||
main()
|
main()
|
||||||
@@ -4,9 +4,12 @@ import time
|
|||||||
from backupSchedule import backupSchedule
|
from backupSchedule import backupSchedule
|
||||||
from plogical.processUtilities import ProcessUtilities
|
from plogical.processUtilities import ProcessUtilities
|
||||||
from re import match,I,M
|
from re import match,I,M
|
||||||
|
import signal
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
class backupScheduleLocal:
|
class backupScheduleLocal:
|
||||||
localBackupPath = '/home/cyberpanel/localBackupPath'
|
localBackupPath = '/home/cyberpanel/localBackupPath'
|
||||||
|
now = datetime.now()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def prepare():
|
def prepare():
|
||||||
@@ -62,5 +65,13 @@ def main():
|
|||||||
backupScheduleLocal.prepare()
|
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__":
|
if __name__ == "__main__":
|
||||||
|
for i in range(1,32):
|
||||||
|
if i == 9 or i == 19 or i == 32:
|
||||||
|
continue
|
||||||
|
signal.signal(i, handler)
|
||||||
main()
|
main()
|
||||||
Reference in New Issue
Block a user