Advertisement
metalx1000

rsync backup

Feb 8th, 2013
690
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. import os
  4. import time
  5.  
  6. now = time.time()
  7. prior_lock = '/home/.backup.lock'
  8. pstamp = os.stat(prior_lock)[9]
  9.  
  10. if (now - pstamp) >= 604800:
  11.     os.system("$(which rsync) -a --inplace /home/ root\@192.168.1.105:/home2/")
  12.     os.system("$(which touch) " . pstamp)
  13.     print "Backup complete."
  14. else:
  15.     print "Backup has already run."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement