From 7d6b15844a2aeda982f16597e5c26dcf662d886c Mon Sep 17 00:00:00 2001 From: root Date: Mon, 22 Jan 2024 17:06:42 +0100 Subject: [PATCH] script de sauvegarde de nextcloud --- roles/nxc-traefik/files/savenextcloud.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 roles/nxc-traefik/files/savenextcloud.sh diff --git a/roles/nxc-traefik/files/savenextcloud.sh b/roles/nxc-traefik/files/savenextcloud.sh new file mode 100644 index 0000000..0dbed33 --- /dev/null +++ b/roles/nxc-traefik/files/savenextcloud.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Mettre le serveur NextCloud en mode maintenance +docker compose exec -u www-data app php occ maintenance:mode --on + +# Extraire les dossiers de sauvegarde +cd /root/nxc + +# Copie locale de la sauvegarde +rsync -Aavx nextcloud/ nextcloud-dirbkp_`date +"%Y%m%d"`/ + +# Base de données MySQL/MariaDB +docker compose exec db mysqldump -u nextcloud -pAzerty1+ nextcloud > nextcloud-sqlbkp_`date +"%Y%m%d"`.bak + +# Sortir du mode maintenance +docker compose exec -u www-data app php occ maintenance:mode --off