From be3cb4eccaa3d7d782b482b8040c71f04fb5a405 Mon Sep 17 00:00:00 2001 From: Theo Vallet Date: Mon, 18 Jan 2021 08:58:54 +0100 Subject: [PATCH] commit backup.sh --- roles/s-backup/files/backup.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 roles/s-backup/files/backup.sh diff --git a/roles/s-backup/files/backup.sh b/roles/s-backup/files/backup.sh new file mode 100644 index 0000000..ad64a50 --- /dev/null +++ b/roles/s-backup/files/backup.sh @@ -0,0 +1,27 @@ +#!/bin/bash +BDIR=/home/backup +SWIN=/tmp/s-win + +[ -d "${BDIR}" ] || mkdir "${BDIR}" +[ -d "${BDIR}" ] || mkdir "${BDIR}/s-win" +[ -d "${SWIN}" ] || mkdir "${SWIN}" + +mount -t cifs -o ro,vers3.0,username=u-backup,password=Azerty1+ //s-win/commun "{SWIN}" +if [ $? != 0 ] ; then + echo "$0 : erreur montage" + exit 1 +fi +rsync -av "${SWIN}"/ /home/backup/s-win/commun +umount "${SWIN}" + + +mount -t cifs -o ro,vers3.0,username=u-backup,password=Azerty1+ //s-win/public "${SWIN}" +if [ $? != 0 ] ; then + echo "$0 : erreur montage" + exit 2 +fi +rsync -av "{SWIN}"/ /home/backup/s-win/public +umount "{SWIN}" + +exit 0 +