32 lines
614 B
Plaintext
32 lines
614 B
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
set -eu
|
||
|
|
||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||
|
ENV_FILE=$DIR/.env
|
||
|
. $DIR/../../../services/gitea/run --only-source
|
||
|
|
||
|
site_help() {
|
||
|
echo "./run backup : Lancer la sauvegarde de git.weko.io"
|
||
|
}
|
||
|
|
||
|
site_backup() {
|
||
|
BACKUP_DATE=`date +%Y%m%d_%H%M%S`
|
||
|
gitea_backup
|
||
|
BACKUP_FILE=~/backups/gitea/${BACKUP_DATE}_gitea_data.tar
|
||
|
scp $SERVER:$BACKUP_FILE backups
|
||
|
ssh $SERVER sudo rm $BACKUP_FILE
|
||
|
}
|
||
|
|
||
|
if [ $# -ge 1 ]; then
|
||
|
if [ "${1}" == "backup" ]; then
|
||
|
script_start
|
||
|
site_backup
|
||
|
script_end
|
||
|
elif [ "${1}" != "--only-source" ]; then
|
||
|
site_help
|
||
|
fi
|
||
|
else
|
||
|
site_help
|
||
|
fi
|