Backup transfer scripts for Linux to Windows


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

Advertisements

3 thoughts on “Backup transfer scripts for Linux to Windows

  1. Hello! I know this is somewhat off topic but I was wondering if you knew where
    I could find a captcha plugin for my comment form?
    I’m using the same blog platform as yours and I’m having difficulty finding one?

    Thanks a lot!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s