Back up files and directories and transfer backup files to windows scripts

  
 

Use: File Backup Description: A file that backs up files and directories and transfers the backup files to Windows. Usage: script name /home backup abc123 //server2000/backup

#!/bin/bash# what do you want backFROM=$1# NT Connection Info ## NT UsernameNTUSER=$2# NT PasswordNTPASSWD=$3# NT ShareName ie //server/backup etcNTSHARE="$4"# BackUpDir NameBACKDIR="$(hostname -s)"# Local mount pointMNT="/mnt/smbbox"# Get date and timeNOW=$(date + "%m-%d-%Y-%I_%M%P")# backup file nameBAKFILE="backup.$NOW.tar.gz"if [ "$#" != "4" ] ;necho "Syntax:"echo "$(basename $0) {Linux-directory} {NTusername} {NTpassword} {//NTserver/share-name}"exit 1fi# make sure $from do exitsif [ ! - d $FROM ]; thenecho "Backup source directory "$FROM" does NOT exist"exit 2fi#Create tar to backup firsttar -czf /tmp/$BAKFILE $FROM #Mount the smb to /mnt[ ! -d $MNT ] && mkdir -p $MNT

Copyright © Windows knowledge All Rights Reserved