def create_backup_directory(self):
"""
Creating timestamped backup directory.
:return: Newly created backup directory or Error.
"""
new_backup_dir = join(self.backupdir,
datetime.now().strftime('%Y-%m-%d_%H-%M-%S'))
try:
# Creating backup directory
makedirs(new_backup_dir)
# Changing owner
chown_command = "chown mysql:mysql %s" % new_backup_dir
status, output = subprocess.getstatusoutput(chown_command)
if status == 0:
return new_backup_dir
else:
print("Could not change owner of backup directory!")
except Exception as err:
print("Something went wrong in create_backup_directory(): {}".format(err))
评论列表
文章目录