add backup for gitea

This commit is contained in:
Mathieu Maret 2020-11-11 21:54:24 +01:00
parent 5950c9e494
commit 12b51ebff3
1 changed files with 19 additions and 0 deletions

19
scripts/backup_gitea.sh Normal file
View File

@ -0,0 +1,19 @@
#!/bin/bash
nb_bk=$(ls ~gitea/*dump*.zip 2>/dev/null| wc -l)
if [ $nb_bk != 0 ]; then
echo "EXISTING GITEA BACKUP!"
exit
fi
sudo -u gitea sh -c "cd ~gitea; gitea dump -c /etc/gitea/app.ini > /dev/null"
backup_file=$(ls ~gitea/*dump*.zip)
#echo "backup file $backup_file"
sudo chown mathieu:mathieu "${backup_file}"
sudo chmod 777 "${backup_file}"
scp "${backup_file}" mathieu@bk.mathux.org:/srv/share/backup/
sudo rm $backup_file