config/scripts/backup_gitea.sh

20 lines
438 B
Bash
Raw Normal View History

2020-11-11 21:54:24 +01:00
#!/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