Advertisement
Guest User

Untitled

a guest
Jan 29th, 2015
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #!/usr/bin/env python
  2. import ConfigParser
  3. import os
  4. import time
  5. import getpass
  6.  
  7. def get_dump():
  8. print "Enter user:"
  9. user = raw_input()
  10.  
  11. print "Password will not be visible:"
  12. password = getpass.getpass()
  13.  
  14. print "Enter host:"
  15. host = raw_input()
  16.  
  17. print "Enter database name:"
  18. database = raw_input()
  19.  
  20.  
  21. filestamp = time.strftime('%Y-%m-%d-%I:%M')
  22. os.popen("mysqldump -u %s -p%s -h %s -e --opt -c %s | gzip -c > %s.gz" % (user,password,host,database,database+"_"+filestamp))
  23.  
  24. print "\n-- please have a the dump file in "+database+"_"+filestamp+".gz --"
  25.  
  26. if __name__=="__main__":
  27. get_dump()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement