#!/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()
本文出自 “itnihao的运维技术博客” 博客,请务必保留此出处http://itnihao.blog.51cto.com/1741976/1160324
以上是小编为您精心准备的的内容,在的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索rsync
, import
, true
, scrapy pyt...
, source
, call
arguments
,以便于您获取更多的相关知识。
时间: 2024-08-24 14:55:27