5 if [ "$#" -lt 2 ]; then
6 echo 'Need two arguments: old server IP, and service name.'
9 if [ ! "$2" = "pleroma" ] && [ ! "$2" = "peertube" ]; then
10 echo "Need legal service name (pleroma or peertube)."
15 if [ "${app}" = "pleroma" ]; then
17 dirs="/var/www/peertube/storage /var/www/peertube/config"
18 elif [ "${app}" = "peertube" ]; then
19 db_name="peertube_prod"
20 dirs="/var/lib/pleroma/uploads /etc/pleroma"
23 config_tree_prefix="${HOME}/config/buster"
24 setup_scripts_dir="${config_tree_prefix}/setup_scripts"
26 cd "${setup_scripts_dir}"
27 ./prepare_to_meet_server.sh "${server_ip}"
28 read -p'Hit Enter when you are done.' ignore
29 eval $(ssh-agent) && ssh-add
30 echo 'Enter password for root on target server next.'
31 ssh plom@"${server_ip}" "su -lc \"cd config/buster/setup_scripts && git pull && ./backup_app.sh ${app} ${db_name} ${dirs}\""
32 scp plom@"${server_ip}":~/${app}_backup.tar /home/plom/${app}_backup.tar
33 ./restore_app.sh "${app}" "${db_name}"