2017-10-24 19:16:36 +05:00
|
|
|
import CyberCPLogFileWriter as logging
|
|
|
|
|
import os
|
|
|
|
|
import time
|
2018-08-18 03:56:25 +05:00
|
|
|
from backupSchedule import backupSchedule
|
2017-10-24 19:16:36 +05:00
|
|
|
|
|
|
|
|
class backupScheduleLocal:
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
|
def prepare():
|
|
|
|
|
try:
|
|
|
|
|
backupLogPath = "/usr/local/lscp/logs/local_backup_log." + time.strftime("%I-%M-%S-%a-%b-%Y")
|
|
|
|
|
|
|
|
|
|
writeToFile = open(backupLogPath, "a")
|
|
|
|
|
|
2018-08-18 03:56:25 +05:00
|
|
|
backupSchedule.remoteBackupLogging(backupLogPath, "#################################################")
|
|
|
|
|
backupSchedule.remoteBackupLogging(backupLogPath," Local Backup log for: " + time.strftime("%I-%M-%S-%a-%b-%Y"))
|
|
|
|
|
backupSchedule.remoteBackupLogging(backupLogPath, "#################################################\n")
|
2017-10-24 19:16:36 +05:00
|
|
|
|
2018-08-18 03:56:25 +05:00
|
|
|
backupSchedule.remoteBackupLogging(backupLogPath, "")
|
|
|
|
|
backupSchedule.remoteBackupLogging(backupLogPath, "")
|
2017-10-24 19:16:36 +05:00
|
|
|
|
|
|
|
|
for virtualHost in os.listdir("/home"):
|
2018-08-18 03:56:25 +05:00
|
|
|
backupSchedule.createLocalBackup(virtualHost, backupLogPath)
|
|
|
|
|
|
|
|
|
|
backupSchedule.remoteBackupLogging(backupLogPath, "")
|
|
|
|
|
backupSchedule.remoteBackupLogging(backupLogPath, "")
|
|
|
|
|
|
|
|
|
|
backupSchedule.remoteBackupLogging(backupLogPath, "#################################################")
|
|
|
|
|
|
|
|
|
|
backupSchedule.remoteBackupLogging(backupLogPath, "")
|
|
|
|
|
backupSchedule.remoteBackupLogging(backupLogPath, "")
|
2017-10-24 19:16:36 +05:00
|
|
|
|
2018-08-18 03:56:25 +05:00
|
|
|
backupSchedule.remoteBackupLogging(backupLogPath, "Local backup job completed.\n")
|
2017-10-24 19:16:36 +05:00
|
|
|
|
|
|
|
|
writeToFile.close()
|
|
|
|
|
|
|
|
|
|
except BaseException,msg:
|
|
|
|
|
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [startBackup]")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
backupScheduleLocal.prepare()
|