check if backup process actually running

This commit is contained in:
Usman Nasir
2020-05-30 12:33:50 +05:00
parent 5b012c7b96
commit 8213708921
2 changed files with 4 additions and 3 deletions

View File

@@ -265,10 +265,11 @@ class backupSchedule:
try:
if os.path.exists(backupSchedule.runningPath):
pid = open(backupSchedule.runningPath, 'r').read()
output = ProcessUtilities.outputExecutioner('ps aux')
if output.find('/usr/local/CyberCP/plogical/backupSchedule.py') > -1:
if output.find('/usr/local/CyberCP/plogical/backupSchedule.py') > -1 and output.find(pid) > -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' % (

View File

@@ -30,9 +30,9 @@ class backupScheduleLocal:
if os.path.exists(backupScheduleLocal.runningPath):
output = ProcessUtilities.outputExecutioner('ps aux')
pid = open(backupScheduleLocal.runningPath, 'r').read()
if output.find('/usr/local/CyberCP/plogical/backupScheduleLocal.py') > -1:
pid = open(backupScheduleLocal.runningPath, 'r').read()
if output.find('/usr/local/CyberCP/plogical/backupScheduleLocal.py') > -1 and output.find(pid) > -1:
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: