Greatly upgrade dbbackup.sh with more verbosity and allow setting the server with the 2nd param
This commit is contained in:
parent
37fcfe652f
commit
dc8ae701f2
@ -1,7 +1,5 @@
|
|||||||
#/bin/sh
|
#/bin/sh
|
||||||
|
|
||||||
name=$(ssh www-data@simalia 'cd dbmanager && ./bin/console db:backup bles' | awk -F'-|\\.def' '{split($1,a," ")}$0=a[4]')
|
dbbackup.sh bles simalia
|
||||||
scp -C www-data@simalia:/var/www/dbmanager/${name} ~/projects/dbmanager
|
|
||||||
cd ~/projects/dbmanager && ./bin/console db:purge bles && ./bin/console db:restore bles ${name}
|
|
||||||
|
|
||||||
scp -Cr www-data@simalia:/var/www/bles.bluelinked.nl/shared/public/uploads/images/ ~/projects/bles/public/uploads/
|
scp -Cr www-data@simalia:/var/www/bles.bluelinked.nl/shared/public/uploads/images/ ~/projects/bles/public/uploads/
|
||||||
|
@ -1,8 +1,16 @@
|
|||||||
#/bin/sh
|
#/bin/sh
|
||||||
|
|
||||||
database=$1
|
database=$1
|
||||||
command="cd dbmanager && ./bin/console db:backup ${database}"
|
server=$2
|
||||||
|
|
||||||
name=$(ssh www-data@cemophora "${command}" | awk -F'-|\\.def' '{split($1,a," ")}$0=a[4]')
|
echo "Backing up ${database}@${server}"
|
||||||
scp -C www-data@cemophora:/var/www/dbmanager/${name} ~/projects/dbmanager
|
command="cd dbmanager && ./bin/console db:backup ${database}"
|
||||||
cd ~/projects/dbmanager && ./bin/console db:purge ${database} && ./bin/console db:restore ${database} ${name}
|
name=$(ssh www-data@${server} "${command}" | awk -F'-|\\.def' '{split($1,a," ")}$0=a[4]')
|
||||||
|
echo "Backup filename: ${name}"
|
||||||
|
|
||||||
|
local_dir="$HOME/projects/dbmanager"
|
||||||
|
echo "Copying ${name} to ${local_dir}"
|
||||||
|
scp -C www-data@${server}:/var/www/dbmanager/${name} "${local_dir}"
|
||||||
|
|
||||||
|
echo "Purging and restoring back to ${database}"
|
||||||
|
cd ${local_dir} && ./bin/console db:purge ${database} && ./bin/console db:restore ${database} ${name}
|
||||||
|
Loading…
Reference in New Issue
Block a user