fix job success calculator
This commit is contained in:
parent
7ef5fac736
commit
6769e83aa1
|
|
@ -25,6 +25,9 @@ class FirewallUtilities:
|
|||
|
||||
@staticmethod
|
||||
def addRule(proto,port):
|
||||
|
||||
print('Adding port: %s' % (port))
|
||||
|
||||
if port == "21":
|
||||
command = "sudo firewall-cmd --add-service=ftp --permanent"
|
||||
else:
|
||||
|
|
@ -56,7 +59,6 @@ class FirewallUtilities:
|
|||
|
||||
@staticmethod
|
||||
def deleteRule(proto, port):
|
||||
print('Adding port: %s' % (port))
|
||||
|
||||
if port=="21":
|
||||
command = "sudo firewall-cmd --remove-service=ftp --permanent"
|
||||
|
|
|
|||
|
|
@ -216,6 +216,7 @@ class backupSchedule:
|
|||
|
||||
backupSchedule.remoteBackupLogging(backupLogPath, "")
|
||||
backupSchedule.remoteBackupLogging(backupLogPath, "")
|
||||
return 1
|
||||
else:
|
||||
|
||||
backupSchedule.remoteBackupLogging(backupLogPath, 'Remote backup creation failed for %s.' % (virtualHost) )
|
||||
|
|
@ -227,6 +228,7 @@ class backupSchedule:
|
|||
|
||||
backupSchedule.remoteBackupLogging(backupLogPath, "")
|
||||
backupSchedule.remoteBackupLogging(backupLogPath, "")
|
||||
return 0
|
||||
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [backupSchedule.createBackup]")
|
||||
|
|
@ -332,8 +334,14 @@ class backupSchedule:
|
|||
|
||||
for virtualHost in os.listdir("/home"):
|
||||
if match(r'^[a-zA-Z0-9-]*[a-zA-Z0-9-]{0,61}[a-zA-Z0-9-](?:\.[a-zA-Z0-9-]{2,})+$', virtualHost, M | I):
|
||||
backupSchedule.createBackup(virtualHost, ipAddress, backupLogPath, port, user)
|
||||
if backupSchedule.createBackup(virtualHost, ipAddress, backupLogPath, port, user):
|
||||
jobSuccessSites = jobSuccessSites + 1
|
||||
else:
|
||||
jobFailedSites = jobFailedSites + 1
|
||||
|
||||
backupSchedule.backupLog.jobFailedSites = jobFailedSites
|
||||
backupSchedule.backupLog.jobSuccessSites = jobSuccessSites
|
||||
backupSchedule.backupLog.save()
|
||||
|
||||
backupSchedule.remoteBackupLogging(backupLogPath, "Remote backup job completed.\n")
|
||||
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ class backupScheduleLocal:
|
|||
|
||||
if retValues[0] == 0:
|
||||
backupSchedule.remoteBackupLogging(backupLogPath, '[ERROR] Backup failed for %s, error: %s moving on..' % (virtualHost, retValues[1]), backupSchedule.ERROR)
|
||||
jobFailedSites = jobFailedSites + 1
|
||||
continue
|
||||
|
||||
if os.path.exists(backupScheduleLocal.localBackupPath):
|
||||
|
|
|
|||
Loading…
Reference in New Issue