mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 13:56:01 +01:00
Update cyberPanel.py
Setup cyberpanel cli createBackup to where it can accept an optional argument for the backup path so scripting full backups to other paths can be done easily.
This commit is contained in:
@@ -333,13 +333,22 @@ class cyberPanel:
|
||||
|
||||
## Backup Functions
|
||||
|
||||
def createBackup(self, virtualHostName):
|
||||
def createBackup(self, virtualHostName, backupPath=None):
|
||||
try:
|
||||
backupLogPath = "/usr/local/lscp/logs/backup_log."+time.strftime("%m.%d.%Y_%H-%M-%S")
|
||||
# Setup default backup path to /home/<domain name>/backup if not passed in
|
||||
if backupPath is None:
|
||||
backupPath = '/home/' + virtualHostName + '/backup'
|
||||
|
||||
# remove trailing slash in path
|
||||
backupPath = backupPath.rstrip("/")
|
||||
backuptime = time.strftime("%m.%d.%Y_%H-%M-%S")
|
||||
backupLogPath = "/usr/local/lscp/logs/backup_log." + backuptime
|
||||
|
||||
print('Backup logs to be generated in %s' % (backupLogPath))
|
||||
|
||||
backupSchedule.createLocalBackup(virtualHostName, backupLogPath)
|
||||
tempStoragePath = backupPath + '/backup-' + virtualHostName + '-' + backuptime
|
||||
backupName = 'backup-' + virtualHostName + '-' + backuptime
|
||||
backupDomain = virtualHostName
|
||||
backupUtilities.submitBackupCreation(tempStoragePath, backupName, backupPath, backupDomain)
|
||||
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
|
||||
Reference in New Issue
Block a user