×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Backup to windows

How to take backup from Linux to Windows? by MaheshRathi
Posted: 7 Feb 02

Backup from Linux to Windows using SMBmount

Here is the modified file for taking backup from linux to windows using smbmount.

1.    Replace NTUsername with network id and NTPassword with network password.
2.    Make the folder shared where you want to take the backup. You should give the full access to that network login ID.
3.    The owner of this script should be root.
4.    Be sure that, smbd and nmbd are running. If not, start them.
5.    If normal user wants to run this script, then be sure that the setUID bit is set for /usr/bin/smbmnt.
6.    Add proper values for DIRTOARCHIVE, MNTPOINT, and ARCHIVETO.
7.    Modify the smbmount command parameters as per your requirement.

######################################################################

#!/bin/sh
#

# Script to backup the /home volume

ADMINID="NTUsername"
ADMINPASSWD="NTPassword"
DAY=`date +%Y%m%d-%H%M`
BACKFILE=<ProjectName>.source.$DAY.tgz
LOGFILE=/tmp/$DAY.backup.log
STARTTIME=`date`
DIRTOARCHIVE=<Directory path to archieve >
MNTPOINT=<Some directory having all permission >/forBackup$DAY
ARCHIVETO=$MNTPOINT/Source/Archive

# First umount and then mount.
###############################
umount $MNTPOINT
mkdir $MNTPOINT

smbmount <//Windows NT server/Folder for backup> $MNTPOINT -o username "$ADMINID/<workgroup>%$ADMINPASSWD"


# Generate the backup file
###############################
cd $ARCHIVETO

if [ `pwd` != "$ARCHIVETO" ]
then
    echo "Aborting backup"
    umount $MNTPOINT
    rmdir $MNTPOINT
        exit 2
fi

{
        echo "\n\n"
    date
    echo "Archiving $DIRTOARCHIVE\n"
    echo "The backup file is $BACKFILE\n"
        echo "Logfile is $LOGFILE

    "
        tar -cvzf $BACKFILE $DIRTOARCHIVE
    
    echo "End of tar process...."

} >| $LOGFILE


#  Unmount
###############################
cd /
umount $MNTPOINT
rmdir $MNTPOINT



Back to Linux (server) FAQ Index
Back to Linux (server) Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close