21 lines
599 B
Bash
21 lines
599 B
Bash
#!/bin/sh
|
|
|
|
# Set up colors
|
|
GREEN='\033[0;32m'
|
|
NC='\033[0m'
|
|
|
|
echo -e "\n${GREEN}`date` - Starting backup...${NC}\n"
|
|
|
|
# Gitea
|
|
echo -e "\n${GREEN}`date` - Backing up Gitea...${NC}\n"
|
|
gitea=$(kubectl get deploy -n gitea -l app=gitea -o name --no-headers=true)
|
|
kubectl scale -n gitea --replicas=0 $gitea
|
|
restic backup /gitea
|
|
restic backup /pg_backup/postgres_backup.dump
|
|
kubectl scale -n gitea --replicas=1 $gitea
|
|
|
|
# Forget and prune
|
|
echo -e "\n${GREEN}`date` - Running forget and prune...${NC}\n"
|
|
restic forget --prune --keep-daily 7 --keep-weekly 2
|
|
echo -e "\n${GREEN}`date` - Backup finished.${NC}\n"
|