``` root@sd1b:~# cat updateB.sh #!/bin/sh timestamp=`date +%s` systemctl stop spacedock.target mkdir sql-backup 2> /dev/null PGPASSWORD=ix32a45 pg_dump -h db.godarklight.info.tm -U sd1a -d sd1a -F t > sd1a-$timestamp.tar if [ $? != 0 ]; then echo "B: PG_DUMP FAILED, ABORTING!" exit 1 fi PGPASSWORD=ix32a45 dropdb -h db.godarklight.info.tm -U sd1b -w sd1b if [ $? != 0 ]; then echo "B: DROPDB FAILED, ABORTING!" exit 2 fi PGPASSWORD=ix32a45 createdb -h db.godarklight.info.tm -U sd1b -w sd1b if [ $? != 0 ]; then echo "B: CREATEDB FAILED, ABORTING!" exit 3 fi PGPASSWORD=ix32a45 pg_restore -h db.godarklight.info.tm -U sd1b -d sd1b -O < sd1a-$timestamp.tar if [ $? != 0 ]; then echo "B: PG_RESTORE FAILED, ABORTING!" exit 4 fi mv sd1a-$timestamp.tar sql-backup/ cd /var/www/virtual/spacedock.info/htdocs/SpaceDock sudo -u www-data bash -c "git fetch --all && git pull && . bin/activate && alembic upgrade head" if [ $? != 0 ]; then echo "B: UPDATE FAILED, ABORTING!" exit 5 fi systemctl start spacedock.target if [ $? != 0 ]; then echo "B: START FAILED, ABORTING!" exit 6 fi echo B: Updated successfully exit 0 ```