bug fix: schedule backup logs

This commit is contained in:
Usman Nasir
2020-05-22 16:57:44 +05:00
parent 79aa5d4c27
commit 8dae110a9c
2 changed files with 17 additions and 16 deletions

View File

@@ -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"

View File

@@ -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')