feat(Nextcloud): Remove run script
This commit is contained in:
parent
669866b44e
commit
264688abf8
|
@ -1,49 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
. $DIR/../help.sh
|
||||
. $DIR/../postgres/run --only-source
|
||||
|
||||
nextcloud_help() {
|
||||
echo "./run backup : Lancement de la sauvegarde de Nextcloud"
|
||||
echo "./run restore : Restauration de la sauvegarde de Nextcloud"
|
||||
}
|
||||
|
||||
nextcloud_backup() {
|
||||
script_env
|
||||
BACKUP_DATE_DEFAULT=`date +%Y%m%d_%H%M%S`
|
||||
BACKUP_DATE=${BACKUP_DATE:-$BACKUP_DATE_DEFAULT}
|
||||
backup_folder_create
|
||||
|
||||
POSTGRES_BACKUP_FILE=backups/${BACKUP_DATE}_${NEXTCLOUD_DOMAIN}_postgres.sql
|
||||
docker-compose exec --user www-data nextcloud php occ maintenance:mode --on
|
||||
postgres_backup
|
||||
|
||||
docker run -it --rm -v $HOME/backups/${NEXTCLOUD_DOMAIN}:/backup --volumes-from nextcloud alpine:3.12.3 ash -c "cd /var/www/html && tar cvf /backup/${BACKUP_DATE}_${NEXTCLOUD_DOMAIN}_files.tar ."
|
||||
docker-compose exec --user www-data nextcloud php occ maintenance:mode --off
|
||||
}
|
||||
|
||||
nextcloud_restore() {
|
||||
script_env
|
||||
|
||||
postgres_restore
|
||||
docker run -it --rm -v $HOME/backups/${NEXTCLOUD_DOMAIN}:/backup -v nextcloud:/var/www/html alpine:3.12.3 ash -c "cd /var/www/html && tar xvf /backup/${BACKUP_DATE}_${NEXTCLOUD_DOMAIN}_files.tar --strip 1"
|
||||
}
|
||||
|
||||
if [ $# -ge 1 ]; then
|
||||
if [ "${1}" == "backup" ]; then
|
||||
script_start
|
||||
nextcloud_backup
|
||||
script_end
|
||||
elif [ "${1}" == "restore" ]; then
|
||||
script_start
|
||||
nextcloud_restore
|
||||
script_end
|
||||
elif [ "${1}" != "--only-source" ]; then
|
||||
nextcloud_help
|
||||
fi
|
||||
else
|
||||
nextcloud_help
|
||||
fi
|
Loading…
Reference in New Issue