Advertisement
Guest User

Untitled

a guest
May 18th, 2017
580
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. #----------------------------------------------------
  4. # a simple mysql database backup script.
  5. # version 0.1, updated April 28, 2017.
  6. # copyright 2017 Arjun Kumbakkara
  7. #----------------------------------------------------
  8.  
  9. #Author:Arjun Kumbakkara
  10. #Organization : 6D Telecom Solutions.
  11.  
  12. # (1) These variables define the backing Up process
  13. FILE=mconnectMediationIrancelDaily.sql.`date +"%Y%m%d"`
  14. DBSERVER=""
  15. DATABASE1=""
  16. DATABASE1=""
  17. DATABASE1=""
  18. USER=uroot
  19. PASS=proot
  20.  
  21.  
  22. # (2)Previous version of the same file removal
  23. unalias rm 2> /dev/null
  24. rm ${FILE} 2> /dev/null
  25. rm ${FILE}.gz 2> /dev/null
  26.  
  27. # (3)The real Deal.
  28.  
  29. # use this command for a database server on a separate host:[in any case that finds a needy context!Yikes]
  30. #mysqldump --opt --protocol=TCP --user=${USER} --password=${PASS} --host=${DBSERVER} ${DATABASE} > ${FILE}
  31.  
  32. #this gives something like this: mysqldump -uroot -proot --databases SOME_BOOT SOME_DEMO_FOR_IRAN SUMTION > db_backup.sql
  33.  
  34.  
  35. # use this command for a database server on localhost. add other options if need be.
  36. mysqldump -${USER} -${PASS} --databases ${DATABASE1} ${DATABASE2} ${DATABASE3} > ${FILE}
  37. echo "Automated Dump of SOME_BOOT,SUMTION,SOME_DEMO_FOR_IRAN Processed."
  38.  
  39. #/home/scmuser/****/CronAutomatedDumps
  40. sshpass -p 'scm@dmin' scp ${FILE} scmuser@10.0.0.18:/home/scmuser/ArjunKumbakkara/CronAutomatedDumps
  41.  
  42. #scp ${FILE} scmuser@10.0.0.0:/home/****/ArjunKumbakkara/CronAutomatedDumps
  43.  
  44.  
  45. #mv ${FILE} -h10.0.0.0
  46.  
  47. # (4) gzip the mysql database dump file
  48. gzip $FILE
  49.  
  50. # (5) The file Creation is notified thus
  51. echo "${FILE}.gz was created:"
  52. ls -l ${FILE}.gz
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement