Last active
September 4, 2019 10:17
-
-
Save habibun/ebc06c73e5efd22dd160b960218a9003 to your computer and use it in GitHub Desktop.
dump-mysql-script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
echo "clearing backup folder......................................................................................"; | |
rm -vrf ~/Backup/* | |
echo "ending clearing backup folder................................................................................"; | |
echo "............................................................................................................"; | |
echo "starting dumping............................................................................................"; | |
echo "............................................................................................................"; | |
current_date_time="`date "+%d_%m_%Y_%H_%M_%S"`"; | |
echo "starting biznet backup......................................................................................"; | |
mysqldump -u root -p"xxx" -h 192.168.0.0 server_db_name > ~/Backup/xxx_live_${current_date_time}.sql -v | |
echo "ending biznet backup...."; | |
echo "starting bbq backup........................................................................................."; | |
mysqldump -u root -p"xxx" -h 192.168.0.0 server_db_name > ~/Backup/xxx_live_${current_date_time}.sql -v | |
echo "ending bbq backup...."; | |
echo "starting hris backup........................................................................................"; | |
mysqldump -u root -p"xxx" -h 192.168.0.0 server_db_name > ~/Backup/xxx_live_${current_date_time}.sql -v | |
echo "ending hris backup.........................................................................................."; | |
echo "............................................................................................................"; | |
echo "starting file operation....................................................................................."; | |
echo "............................................................................................................"; | |
echo "starting copying biznet file to external drive................................................................"; | |
xxxDir="/xxx/xxx/xxx/xxx/xxx/" | |
find "${HOME}/Backup/" -name "xxx*.sql" | while read -r file | |
do | |
cp -v "${file}" "${biznetDir}" | |
done | |
echo "starting copying bbq file to external drive................................................................"; | |
xxDir="/xxx/xxx/xxx/xxx/xxx/" | |
find "${HOME}/Backup/" -name "xxx*.sql" | while read -r file | |
do | |
cp -v "${file}" "${bbqDir}" | |
done | |
echo "starting copying hris file to external drive................................................................"; | |
xDir="/media/xxx/3285D7E423244D1E/dumps/hris/" | |
find "${HOME}/Backup/" -name "xxx*.sql" | while read -r file | |
do | |
cp -v "${file}" "${hrisDir}" | |
done | |
echo "starting uploading file to google drive......................................................................."; | |
cd ~/Backup/; grive -VP | |
echo "end all operation............................................................................................."; | |
~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment