different backups for primary and secondary
[scripts/scripts.git] / backup_win.sh
1 #!/bin/bash
2
3 # small backup script for maiks wondoof stuff ... definetly pr0n!
4 # please check carefully! DATALOSS POSSIBLE :)
5
6 # edit this variables @ maik
7 SERVICES="//arbeitsplatz/foo //arbeitsplatz/bar"
8 BACKUPDIR="/backup"
9 USER="maik"
10 PASSWORD="mausschubser"
11
12 # do no longer edit the following variables :)
13 MOUNT="mount -t smbfs"
14 MOUNTOPT="-o username=$USER,password=$PASSWORD"
15
16 # kernel must understand smbfs
17 modprobe smbfs > /dev/null 2>&1
18
19 for service in $SERVICES; do
20         mntpt=`echo $service | awk -F/ '{ print $4 }'`
21         mkdir -p /tmp/$mntpt
22         $MOUNT $service /tmp/$mntpt $MOUNTOPT
23         echo
24         echo "backuping files from $service to $BACKUPDIR ..."
25         echo
26         rsync -avz /tmp/$mntpt $BACKUPDIR
27         OK=0
28         umount /tmp/$mntpt && OK=1
29         if [ "$OK" = "1" ] ; then
30                 rm -rf /tmp/$mntpt
31         else
32                 echo "umount failed, not delelting mountpoint $mntpt..."
33         fi
34 done