作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已经返回了一个 python 脚本来获取特定表的 postgresql 数据库转储,我怎样才能有一天将特定表的转储或增量数据转储到 .sql 文件。
username = 'postgres'
port = 5432
date = time.strftime('%Y-%m-%d')
base = 'databasename'
if base == 'databasename':
filename = "%s/%s-%s.sql" % (fulldir, base, date)
os.popen("nice -n 19 pg_dump -C -t table1 -t table2 -t table3 -t table4 -F p -U%s -p%s %s > %s" % (username, port, base, filename))
print(base + "backup taken")
最佳答案
您可以将此 python 制作为可执行文件,然后打开您的 linux 终端并使用 corntab -e 命令编辑 crontab 并将命令放在那里
30 23 * * * your_executable_file_name
这将在服务器时间的每天晚上 11:30 进行备份。希望这对您有所帮助。
关于python - python中的增量postgresql数据转储,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35124062/
我正在为我的应用程序使用 Tank-Auth。我唯一的问题是激活和重置帐户密码。 用于登录、注册、注销;我对这些代码没有问题; $route['login'] = "/auth/login"; $ro
我是一名优秀的程序员,十分优秀!