Advertisement
Guest User

Untitled

a guest
Nov 27th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. #----------------------------------------------------
  4. # a simple mysql database backup script.
  5. # version 2, updated March 26, 2011.
  6. # copyright 2011 alvin alexander, http://devdaily.com
  7. #----------------------------------------------------
  8. # This work is licensed under a Creative Commons
  9. # Attribution-ShareAlike 3.0 Unported License;
  10. # see http://creativecommons.org/licenses/by-sa/3.0/
  11. # for more information.
  12. #----------------------------------------------------
  13.  
  14. # (1) set up all the mysqldump variables
  15. FILE=minime.sql.`date +"%Y%m%d"`
  16. DBSERVER=127.0.0.1
  17. DATABASE=REJESTRACJA
  18. USER=LOGOWANIE
  19. PASS=KdsuvY&82hdF@
  20.  
  21. # (2) in case you run this more than once a day, remove the previous version of the file
  22. unalias rm 2> /dev/null
  23. rm ${FILE} 2> /dev/null
  24. rm ${FILE}.gz 2> /dev/null
  25.  
  26. # (3) do the mysql database backup (dump)
  27.  
  28. # use this command for a database server on a separate host:
  29. #mysqldump --opt --protocol=TCP --user=${USER} --password=${PASS} --host=${DBSERVER} ${DATABASE} > ${FILE}
  30.  
  31. # use this command for a database server on localhost. add other options if need be.
  32. mysqldump --opt --user=${USER} --password=${PASS} ${DATABASE} > ${FILE}
  33.  
  34. # (4) gzip the mysql database dump file
  35. gzip $FILE
  36.  
  37. # (5) show the user the result
  38. echo "${FILE}.gz was created:"
  39. ls -l ${FILE}.gz
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement