diff --git a/plogical/backupSchedule.py b/plogical/backupSchedule.py index 75c440e75..f988fd75c 100755 --- a/plogical/backupSchedule.py +++ b/plogical/backupSchedule.py @@ -265,9 +265,18 @@ class backupSchedule: try: if os.path.exists(backupSchedule.runningPath): - pid = open(backupSchedule.runningPath, 'r').read() - 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 + + output = ProcessUtilities.outputExecutioner('ps aux') + + if output.find('/usr/local/CyberCP/plogical/backupSchedule.py') > -1: + pid = open(backupSchedule.runningPath, 'r').read() + 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 + else: + os.remove(backupSchedule.runningPath) + writeToFile = open(backupSchedule.runningPath, 'w') writeToFile.write(str(os.getpid())) diff --git a/plogical/backupScheduleLocal.py b/plogical/backupScheduleLocal.py index b233d8789..32b379757 100755 --- a/plogical/backupScheduleLocal.py +++ b/plogical/backupScheduleLocal.py @@ -29,9 +29,14 @@ class backupScheduleLocal: try: if os.path.exists(backupScheduleLocal.runningPath): - pid = open(backupScheduleLocal.runningPath, 'r').read() - 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 + output = ProcessUtilities.outputExecutioner('ps aux') + + if output.find('/usr/local/CyberCP/plogical/backupScheduleLocal.py') > -1: + pid = open(backupScheduleLocal.runningPath, 'r').read() + 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 + else: + os.remove(backupScheduleLocal.runningPath) writeToFile = open(backupScheduleLocal.runningPath, 'w') writeToFile.write(str(os.getpid()))