32 lines
602 B
Bash
32 lines
602 B
Bash
#!/bin/bash
|
|
|
|
set -eu
|
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
ENV_FILE=$DIR/.env
|
|
. $DIR/../../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
|