Skip to content

Instantly share code, notes, and snippets.

@include
Created July 4, 2013 11:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save include/5926793 to your computer and use it in GitHub Desktop.
Save include/5926793 to your computer and use it in GitHub Desktop.
#! /usr/bin/env python
# -*- conding: UTF-8 -*-
import sys
import os
import time
def main():
'''yep this is an awesome but tiny test'''
if len(sys.argv) < 3:
print "define dir to backup and backup destination"
sys.exit(1)
else:
backup_dir = sys.argv[1]
backup_file = time.localtime()
backup_dest = sys.argv[2]
cmd = "tar -czvf " + str(backup_file.tm_hour) + ".tar.gz " + backup_dir
if os.system(cmd) == 0:
print "YHE"
else:
print "backup failed"
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment