Merge branch 'gentoo-sway' of git.darkou.fr:dbroqua/home into gentoo-sway
This commit is contained in:
commit
1999acf33d
1 changed files with 76 additions and 67 deletions
143
bin/rsync.sh
143
bin/rsync.sh
|
@ -3,39 +3,39 @@
|
||||||
TYPE='' # usb / sshfs
|
TYPE='' # usb / sshfs
|
||||||
CMD=rsync
|
CMD=rsync
|
||||||
ARGS='-avz --delete
|
ARGS='-avz --delete
|
||||||
--exclude /Nextcloud
|
--exclude /Nextcloud
|
||||||
--exclude /.cache
|
--exclude /.cache
|
||||||
--exclude /Downloads
|
--exclude /Downloads
|
||||||
--exclude /.thunderbird
|
--exclude /.thunderbird
|
||||||
--exclude /Projects
|
--exclude /Projects
|
||||||
--exclude /Software
|
--exclude /Software
|
||||||
--exclude /tmp
|
--exclude /tmp
|
||||||
--exclude /fonts
|
--exclude /fonts
|
||||||
--exclude /Music
|
--exclude /Music
|
||||||
--exclude /node_modules
|
--exclude /node_modules
|
||||||
--exclude /snap
|
--exclude /snap
|
||||||
--exclude /.local/share/Trash
|
--exclude /.local/share/Trash
|
||||||
--exclude /.npm
|
--exclude /.npm
|
||||||
--exclude /.thumbnails
|
--exclude /.thumbnails
|
||||||
--exclude /Android
|
--exclude /Android
|
||||||
--exclude /.AndroidStudio*
|
--exclude /.AndroidStudio*
|
||||||
--exclude /.android
|
--exclude /.android
|
||||||
--exclude /.bundle/cache
|
--exclude /.bundle/cache
|
||||||
--exclude /.config/cache
|
--exclude /.config/cache
|
||||||
--exclude /.config/Code/Cache
|
--exclude /.config/Code/Cache
|
||||||
--exclude /.config/Code/CachedData
|
--exclude /.config/Code/CachedData
|
||||||
--exclude /.config/Slack
|
--exclude /.config/Slack
|
||||||
--exclude /.config/*/Cache
|
--exclude /.config/*/Cache
|
||||||
--exclude /.config/chromium
|
--exclude /.config/chromium
|
||||||
--exclude /.mozilla
|
--exclude /.mozilla
|
||||||
--exclude /.config/discord
|
--exclude /.config/discord
|
||||||
--exclude /.config/spotify
|
--exclude /.config/spotify
|
||||||
--exclude /.crashlytics
|
--exclude /.crashlytics
|
||||||
--exclude /.fastlane
|
--exclude /.fastlane
|
||||||
--exclude /.gradle
|
--exclude /.gradle
|
||||||
--exclude ./Software
|
--exclude ./Software
|
||||||
--exclude /.local
|
--exclude /.local
|
||||||
--exclude /.DataGrip*'
|
--exclude /.DataGrip*'
|
||||||
ORIG='/home/dbroqua/'
|
ORIG='/home/dbroqua/'
|
||||||
DEST=''
|
DEST=''
|
||||||
HOSTNAME=`hostname`
|
HOSTNAME=`hostname`
|
||||||
|
@ -48,46 +48,55 @@ DEST_USB="/mnt/backup/${HOSTNAME}/dbroqua/"
|
||||||
# SSHFS
|
# SSHFS
|
||||||
DEST_SSHFS="storage:Backup/${HOSTNAME}/dbroqua/"
|
DEST_SSHFS="storage:Backup/${HOSTNAME}/dbroqua/"
|
||||||
|
|
||||||
echo `date` > ${ORIG}/lastBackup
|
|
||||||
|
|
||||||
while getopts t:h opt
|
while getopts t:h opt
|
||||||
do
|
do
|
||||||
case $opt in
|
case $opt in
|
||||||
t)
|
t)
|
||||||
case ${OPTARG} in
|
case ${OPTARG} in
|
||||||
usb)
|
usb)
|
||||||
TYPE='usb'
|
TYPE='usb'
|
||||||
DEST=${DEST_USB}
|
DEST=${DEST_USB}
|
||||||
;;
|
;;
|
||||||
sshfs)
|
sshfs)
|
||||||
TYPE='sshfs'
|
TYPE='sshfs'
|
||||||
DEST=${DEST_SSHFS}
|
DEST=${DEST_SSHFS}
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "usb / sshfs attendu"
|
echo "usb / sshfs attendu"
|
||||||
exit 1;
|
exit 1;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Method: ${TYPE}" >> ${ORIG}/lastBackup
|
|
||||||
|
|
||||||
if [ "${TYPE}" != '' ] ; then
|
if [ "${TYPE}" != '' ] ; then
|
||||||
case ${TYPE} in
|
case ${TYPE} in
|
||||||
usb)
|
usb)
|
||||||
sudo cryptsetup luksOpen /dev/sdb1 backup
|
sudo cryptsetup luksOpen /dev/sdb1 backup
|
||||||
sudo mount /dev/mapper/backup ${MOUNT}
|
sudo mount /dev/mapper/backup ${MOUNT}
|
||||||
echo "Go !"
|
echo "Go !"
|
||||||
if [ $? == 0 ] ; then
|
if [ $? == 0 ] ; then
|
||||||
${CMD} ${ARGS} ${ORIG} ${DEST}
|
${CMD} ${ARGS} ${ORIG} ${DEST}
|
||||||
fi
|
fi
|
||||||
sudo umount ${MOUNT}
|
sudo umount ${MOUNT}
|
||||||
sudo cryptsetup luksClose backup
|
sudo cryptsetup luksClose backup
|
||||||
;;
|
;;
|
||||||
sshfs)
|
sshfs)
|
||||||
${CMD} ${ARGS} ${ORIG} ${DEST}
|
${CMD} ${ARGS} ${ORIG} ${DEST}
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $?
|
||||||
|
|
||||||
|
if [ $? == 0 ] ; then
|
||||||
|
echo `date` > ${ORIG}/lastBackup
|
||||||
|
echo "Method: ${TYPE}" >> ${ORIG}/lastBackup
|
||||||
|
rm ${ORIG}/lastFailBackup
|
||||||
|
else
|
||||||
|
echo `date` > ${ORIG}/lastFailBackup
|
||||||
|
echo "Method: ${TYPE}" >> ${ORIG}/lastFailBackup
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue