backup_nuc/backup.sh

57 lines
1.3 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
docker-compose -f docker/nextcloud/docker-compose.yml down
./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
# docker/gitea/start.sh
docker start 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
# docker/influx/start.sh
# docker/grafana/start.sh
docker start influx
docker start 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'