Hi folks!!!
This script will help you in understanding how to transfer the backup from a linux machine to windows. This is a small sample script you have to really tweak into it for a full proof system.
Step1: Create a share directory on windows machine
Step2: Create the transfer.sh script on your linux machine
Transfer.sh
#! /usr/local/bin
# specify the backup folder
backup_src=/backup/user1
# attach timestamp if required
# timestamp=`date +%d%m%y`
# dir=”$des”user1″$timestamp”
# Check if the backup source exist
if [ ! -d “$backup_src” ] ; then
echo “backup not possible directory does not exist”
echo “Source directory does not exist” | mail -s “Backup not possible: ” vyvaks@vyvaks.com
exit
else
# Mount the windows share point to transfer the backup
mount -t smbfs -o username=vyvaks,password=vyvaks //172.168.1.162/backupStore /mnt/backupStore/
if [ $? != 0 ]
then
echo ” Mount error ”
echo ” Mount error ” | mail -s “Backup not possible: ” vyvaks@vyvaks.com
exit
fi
sleep 2
# copy the backup to mount point
cp -r $backup_src /mnt/bkup
if [ $? != 0 ]
then
echo “Copy Failed” | mail -s “Backup not possible: ” vyvaks@vyvaks.com
umount /mnt/bkup
exit
fi
# Unmount the windows mount point
umount /mnt/bkup
echo “Backup sucessfully transfered” | mail -s “Backup done : ” vyvaks@vyvaks.com
Step 3: Finally for scheduling add the script to the cron