diff --git a/scripts/backup_gitea.sh b/scripts/backup_gitea.sh old mode 100644 new mode 100755 index 50c1a60..7a96d28 --- a/scripts/backup_gitea.sh +++ b/scripts/backup_gitea.sh @@ -1,16 +1,18 @@ #!/bin/bash -nb_bk=$(ls ~gitea/*dump*.zip 2>/dev/null| wc -l) +nb_bk=$(sudo ls /var/lib/gitea/ | egrep ".*dump.*.zip" |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) +sudo -u gitea sh -c "cd ~gitea; gitea dump -c /etc/gitea/app.ini > /dev/null 2>&1" +backup_file=$(sudo ls /var/lib/gitea/ | egrep ".*dump.*.zip") +backup_file="/var/lib/gitea/"$backup_file +sudo mv $backup_file /tmp/ +backup_file="/tmp/$(basename $backup_file)" #echo "backup file $backup_file" sudo chown mathieu:mathieu "${backup_file}" sudo chmod 777 "${backup_file}"