backup_calculation.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:autotokubackup 作者: Percona-Lab 项目源码 文件源码
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))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号