You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- #!/bin/bash
-
- # Variables
- BACKUP_ROOT_GITEA="/backup/gitea"
- BACKUP_GITEA_RETENTION=10
-
- # Starting backup
- echo "Starting gitea backup process ..."
-
- # Backup server configuration
- mkdir -p ${BACKUP_ROOT_GITEA}
- HOUR=`date +%Y%m%d%H%M`
-
- # Launch dump command on docker
- docker exec -w /data $(docker ps -qf "name=gitea") su - git sh -c "/app/gitea/gitea dump -c /data/gitea/conf/app.ini -f gitea-dump-${HOUR}.zip"
- # And get from docker
- docker cp $(docker ps -qf "name=gitea"):/data/git/gitea-dump-${HOUR}.zip ${BACKUP_ROOT_GITEA}
- # Finally, remove backup on container
- docker exec -w /data $(docker ps -qf "name=gitea") su - git sh -c "rm gitea-dump-${HOUR}.zip"
-
- # Purge old backup
- echo "Starting gitea purge process for backup older than ${BACKUP_GITEA_RETENTION} ..."
- find ${BACKUP_ROOT_GITEA} -type f -mtime +${BACKUP_GITEA_RETENTION} -exec rm -f {} \;
|