From 8dae110a9ce1d02173b7afa5f4c85300a1ba556e Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Fri, 22 May 2020 16:57:44 +0500 Subject: [PATCH] bug fix: schedule backup logs --- plogical/backupSchedule.py | 31 ++++++++++++++++--------------- plogical/backupScheduleLocal.py | 2 +- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/plogical/backupSchedule.py b/plogical/backupSchedule.py index 91a5c452e..0227aed6d 100755 --- a/plogical/backupSchedule.py +++ b/plogical/backupSchedule.py @@ -230,26 +230,13 @@ class backupSchedule: if os.path.exists(backupSchedule.runningPath): pid = open(backupSchedule.runningPath, 'r').read() - print('Remote backup is already running with PID: %s. If you want to run againly kindly kill the backup process: \n\n kill -9 %s.\n\n' % (pid, pid)) + print('\n\nRemote backup is already running with PID: %s. If you want to run again kindly kill the backup process: \n\n kill -9 %s.\n\n' % (pid, pid)) return 0 writeToFile = open(backupSchedule.runningPath, 'w') writeToFile.write(str(os.getpid())) writeToFile.close() - - destinations = backupUtilities.destinationsPath - - backupLogPath = "/usr/local/lscp/logs/backup_log."+time.strftime("%m.%d.%Y_%H-%M-%S") - - - backupSchedule.remoteBackupLogging(backupLogPath,"#################################################") - backupSchedule.remoteBackupLogging(backupLogPath," Backup log for: " +time.strftime("%m.%d.%Y_%H-%M-%S")) - backupSchedule.remoteBackupLogging(backupLogPath,"#################################################\n") - - backupSchedule.remoteBackupLogging(backupLogPath, "") - backupSchedule.remoteBackupLogging(backupLogPath, "") - ## IP of Remote server. destinations = backupUtilities.destinationsPath @@ -266,10 +253,24 @@ class backupSchedule: jobSuccessSites = 0 jobFailedSites = 0 + backupLogPath = "/usr/local/lscp/logs/backup_log." + time.strftime("%m.%d.%Y_%H-%M-%S") + backupSchedule.backupLog = BackupJob(logFile=backupLogPath, location=backupSchedule.REMOTE, - jobSuccessSites=jobSuccessSites, jobFailedSites=jobFailedSites, ipAddress=ipAddress, port=port) + jobSuccessSites=jobSuccessSites, jobFailedSites=jobFailedSites, + ipAddress=ipAddress, port=port) backupSchedule.backupLog.save() + + destinations = backupUtilities.destinationsPath + + + backupSchedule.remoteBackupLogging(backupLogPath,"#################################################") + backupSchedule.remoteBackupLogging(backupLogPath," Backup log for: " +time.strftime("%m.%d.%Y_%H-%M-%S")) + backupSchedule.remoteBackupLogging(backupLogPath,"#################################################\n") + + backupSchedule.remoteBackupLogging(backupLogPath, "") + backupSchedule.remoteBackupLogging(backupLogPath, "") + ## IPAddress of local server ipFile = "/etc/cyberpanel/machineIP" diff --git a/plogical/backupScheduleLocal.py b/plogical/backupScheduleLocal.py index d37b1bb43..3a69f20fa 100755 --- a/plogical/backupScheduleLocal.py +++ b/plogical/backupScheduleLocal.py @@ -30,7 +30,7 @@ class backupScheduleLocal: if os.path.exists(backupScheduleLocal.runningPath): pid = open(backupScheduleLocal.runningPath, 'r').read() - print('Local backup is already running with PID: %s. If you want to run againly kindly kill the backup process: \n\n kill -9 %s.\n\n' % (pid, pid)) + print('\n\nLocal backup is already running with PID: %s. If you want to run again kindly kill the backup process: \n\n kill -9 %s.\n\n' % (pid, pid)) return 0 writeToFile = open(backupScheduleLocal.runningPath, 'w')