X-Git-Url: https://hackdaworld.org/gitweb/?p=scripts%2Fscripts.git;a=blobdiff_plain;f=backup_win.sh;fp=backup_win.sh;h=53ee0d6c724c0c6586f1bd45b7d80e15591c7d10;hp=0000000000000000000000000000000000000000;hb=59e8cf81480a3c3a1723252967c6405ae2a4aca4;hpb=639e6b035157d1c8de8e50eaae4526b51eb97426 diff --git a/backup_win.sh b/backup_win.sh new file mode 100755 index 0000000..53ee0d6 --- /dev/null +++ b/backup_win.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# small backup script for maiks wondoof stuff ... definetly pr0n! +# please check carefully! DATALOSS POSSIBLE :) + +# edit this variables @ maik +SERVICES="//arbeitsplatz/foo //arbeitsplatz/bar" +BACKUPDIR="/backup" +USER="maik" +PASSWORD="mausschubser" + +# do no longer edit the following variables :) +MOUNT="mount -t smbfs" +MOUNTOPT="-o username=$USER,password=$PASSWORD" + +# kernel must understand smbfs +modprobe smbfs > /dev/null 2>&1 + +for service in $SERVICES; do + mntpt=`echo $service | awk -F/ '{ print $4 }'` + mkdir -p /tmp/$mntpt + $MOUNT $service /tmp/$mntpt $MOUNTOPT + echo + echo "backuping files from $service to $BACKUPDIR ..." + echo + rsync -avz /tmp/$mntpt $BACKUPDIR + OK=0 + umount /tmp/$mntpt && OK=1 + if [ "$OK" = "1" ] ; then + rm -rf /tmp/$mntpt + else + echo "umount failed, not delelting mountpoint $mntpt..." + fi +done