dbrestore.py 文件源码

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

项目:tools 作者: apertoso 项目源码 文件源码
def restore_db_docker(self, zipfile):
        command = ''' /usr/bin/7z x -so {} dump.sql | ''' \
                  ''' docker run -i --rm --link {}:{} postgres:{} ''' \
                  ''' /bin/bash -c 'echo "{}:5432:*:{}:{}" ''' \
                  ''' > ~/.pgpass; chmod 600 ~/.pgpass; ''' \
                  ''' /usr/lib/postgresql/{}/bin/psql ''' \
                  ''' -q -h {} -U {} {} > /dev/null' ''' \
                  .format(zipfile, self.db_host, self.db_host, self.pgversion,
                          self.db_host, self.db_user, self.db_password,
                          self.pgversion, self.db_host, self.db_user,
                          self.target_db
                          )
        subprocess.check_call(command, shell=True)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号