backup_nuc/update.sh

50 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
# wake up backup machine
./wake_probook.sh 20
if [ $? -ne 0 ]; then
echo "Unable to wake up backup machine"
exit 1
fi
# stop web server to avoid access
echo "Stopping web server"
systemctl stop nginx
# nextcloud
echo "Backup nextcloud..."
docker-compose -f docker/nextcloud/docker-compose.yml down --rmi all
./borg.sh Nextcloud /srv/nextcloud
./borg.sh Postgres /srv/postgres-data
docker-compose -f docker/nextcloud/docker-compose.yml up -d
# gitea
echo "Backup gitea..."
docker stop gitea
docker rm gitea
docker rmi gitea/gitea:latest
./borg.sh Gitea /srv/gitea
# influx/grafana
echo "Backup influx/grafana..."
docker stop influx
docker rm influx
docker stop grafana
docker rm grafana
docker rmi influxdb grafana/grafana-oss
./borg.sh Influx /srv/influx
./borg.sh Grafana /srv/grafana
# activitycollect
echo "Backup activitycollect..."
docker stop activitycollect
./borg.sh Activitycollect /srv/activitycollect
docker start activitycollect
# re-start nginx
echo "Starting nginx"
systemctl start nginx
# shutdown backup machine
ssh root@probook 'systemctl poweroff'