mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-12 00:06:09 +01:00
check if backup process actually running
This commit is contained in:
@@ -265,9 +265,18 @@ class backupSchedule:
|
|||||||
try:
|
try:
|
||||||
|
|
||||||
if os.path.exists(backupSchedule.runningPath):
|
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))
|
output = ProcessUtilities.outputExecutioner('ps aux')
|
||||||
return 0
|
|
||||||
|
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 = open(backupSchedule.runningPath, 'w')
|
||||||
writeToFile.write(str(os.getpid()))
|
writeToFile.write(str(os.getpid()))
|
||||||
|
|||||||
@@ -29,9 +29,14 @@ class backupScheduleLocal:
|
|||||||
try:
|
try:
|
||||||
|
|
||||||
if os.path.exists(backupScheduleLocal.runningPath):
|
if os.path.exists(backupScheduleLocal.runningPath):
|
||||||
pid = open(backupScheduleLocal.runningPath, 'r').read()
|
output = ProcessUtilities.outputExecutioner('ps aux')
|
||||||
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
|
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 = open(backupScheduleLocal.runningPath, 'w')
|
||||||
writeToFile.write(str(os.getpid()))
|
writeToFile.write(str(os.getpid()))
|
||||||
|
|||||||
Reference in New Issue
Block a user