2020-05-16 00:47:59 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
ENV_FILE=$DIR/.env
|
2020-05-19 15:22:16 +02:00
|
|
|
. $DIR/../../gitea/run --only-source
|
2020-05-16 00:47:59 +02:00
|
|
|
|
|
|
|
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
|