stuff
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
now=$(date +"%Y%m%d%H%M")
|
||||
|
||||
declare -a arr=("gitea" "mail" "matrix" "monitoring")
|
||||
declare -a monitoring=("monitoring_prometheus-data" "monitoring_grafana-storage" "monitoring_loki-data" "monitoring_alloy-data")
|
||||
declare -a matrix=("matrix_db")
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
for i in "${arr[@]}"
|
||||
do
|
||||
cd /opt/beeserver/${i}
|
||||
podman-compose down -t 60
|
||||
if [[ "$i" == "monitoring" ]]
|
||||
then
|
||||
for j in "${monitoring[@]}"
|
||||
do
|
||||
podman volume export ${j} --output ${j}.tar
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ "$i" == "matrix" ]]
|
||||
then
|
||||
for j in "${matrix[@]}"
|
||||
do
|
||||
podman volume export ${j} --output ${j}.tar
|
||||
done
|
||||
fi
|
||||
rsync -aH /opt/beeserver/${i} /opt/backup/beeserver
|
||||
podman-compose up -d
|
||||
done
|
||||
|
||||
tar -czf - /opt/backup/beeserver | gpg --batch --passphrase-file /opt/backup/passphrase.txt -c -o /home/beeshare/raid/serverBackup/beeserver_daily_${now}.tar.gz.gpg
|
||||
|
||||
function cleanup()
|
||||
{
|
||||
for j in "${monitoring[@]}"
|
||||
do
|
||||
rm -rf /opt/beeserver/monitoring/${j}.tar
|
||||
done
|
||||
|
||||
for j in "${matrix[@]}"
|
||||
do
|
||||
rm -rf /opt/beeserver/matrix/${j}.tar
|
||||
done
|
||||
}
|
||||
Reference in New Issue
Block a user