Python 官方文档:入门教程 => 点击学习
python code rsync #!/usr/bin/env pyt hon #wraps up rsync to synchronize two directories from subprocess import call i
python code rsync
- #!/usr/bin/env pyt hon
- #wraps up rsync to synchronize two directories
-
- from subprocess import call
- import sys
- import time
-
- """this motivated rsync tries to synchronize forever"""
-
- source = "/tmp/sync_dir_A"
- target = "/tmp/sync_dir_B"
- rsync = "rsync"
- arguments = "-av"
- cmd = "%s %s %s %s" % (rsync,arguments,source,target)
-
- def sync():
- while True:
- ret = call(cmd,shell=True)
- if ret !=0:
- print "resubmitting rsync"
- time.sleep(5)
- else:
- print "rsync was successful"
- cmd_mail="echo 'jobs done'|mail -s 'jobs done' itnihao@qq.com"
- call(cmd_mail,shell=True)
- sys.exit(0)
- sync()
--结束END--
本文标题: rsync to synchronize
本文链接: https://lsjlt.com/news/185367.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0