Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- #----------------------------------------------------
- # a simple mysql database backup script.
- # version 0.1, updated April 28, 2017.
- # copyright 2017 Arjun Kumbakkara
- #----------------------------------------------------
- #Author:Arjun Kumbakkara
- #Organization : 6D Telecom Solutions.
- # (1) These variables define the backing Up process
- FILE=mconnectMediationIrancelDaily.sql.`date +"%Y%m%d"`
- DBSERVER=""
- DATABASE1=""
- DATABASE1=""
- DATABASE1=""
- USER=uroot
- PASS=proot
- # (2)Previous version of the same file removal
- unalias rm 2> /dev/null
- rm ${FILE} 2> /dev/null
- rm ${FILE}.gz 2> /dev/null
- # (3)The real Deal.
- # use this command for a database server on a separate host:[in any case that finds a needy context!Yikes]
- #mysqldump --opt --protocol=TCP --user=${USER} --password=${PASS} --host=${DBSERVER} ${DATABASE} > ${FILE}
- #this gives something like this: mysqldump -uroot -proot --databases SOME_BOOT SOME_DEMO_FOR_IRAN SUMTION > db_backup.sql
- # use this command for a database server on localhost. add other options if need be.
- mysqldump -${USER} -${PASS} --databases ${DATABASE1} ${DATABASE2} ${DATABASE3} > ${FILE}
- echo "Automated Dump of SOME_BOOT,SUMTION,SOME_DEMO_FOR_IRAN Processed."
- #/home/scmuser/****/CronAutomatedDumps
- sshpass -p 'scm@dmin' scp ${FILE} scmuser@10.0.0.18:/home/scmuser/ArjunKumbakkara/CronAutomatedDumps
- #scp ${FILE} scmuser@10.0.0.0:/home/****/ArjunKumbakkara/CronAutomatedDumps
- #mv ${FILE} -h10.0.0.0
- # (4) gzip the mysql database dump file
- gzip $FILE
- # (5) The file Creation is notified thus
- echo "${FILE}.gz was created:"
- ls -l ${FILE}.gz
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement