I am wondering if anyone could help with a backup script. I am kind of new to this scripting stuff, so any help would be great. Here is the code I am using:
Code:
#/bin/bash
#linux/windows backup script for network shares
#to external hard drive
#written by: dennis williams
#june 29, 2004
#
#-------These are the environment variables----------------
#
$USERNAME1=username
$PASSWORD1=password
$TARGET_MACHINE=target_machine_name
#
#-------Backup_share can also be set where "mount -t smbfs" is below
#-------this is good if there are spaces in the share name
#
#$BACKUP_SHARE=name_of_the_share_on_the_windows_computer
#
#------------End Variables---------------------------------
#
#------------where all of the work is done-----------------
#
#if mount | grep -q /mnt/backup; then
# echo "backup is already in progress" >&2
# exit 1
#fi
#mount -t smbfs "//$TARGET_MACHINE/$BACKUP_SHARE" /mnt/backup -o "password=$PASSWORD1,username=$USERNAME1"
#(cd /mnt/backup; tar -cvp .) | bzip2 >"$DRIVE/$TARGET_MACHINE.tar.bz2"
#umount /mnt/backup
#
#-----------checks to see if the backup has already started------------
#
if mount |grep -q /mnt/backup; then
echo "backup is already in progress" >&2
exit 1
fi
#
#---------------------------ends the check-----------------------------
#
mount -t smbfs "//$TARGET_MACHINE/$BACKUP_SHARE" /mnt/backup -o "password=$PASSWORD1, username=$USERNAME1"
(cd /mnt/backup; tar -cvp .) | bzip2 >"$DRIVE/$TARGET_MACHINE.tar.bz2"
umount /mnt/backup
#
#-------------------------end of script--------------------------------
#----you will be left with a tar file with the name of the computer----
#
and this is the error I am getting:
Code:
-----ends the check---
#
mount -t smbfs .... etc
*
Could not resolve mount point /mnt/backup
(cd /mnt/backup; tar -cvp .)bzip2 >$DRIVE/$TARGET_MACHINE.tar.bz2
laptop.txt: line 40: cd: .mnt/backup: No such file or directory
./
./cron.txt
./backup.txt
./master.txt
./drive
./christa.txt
./laptop.txt
umount /mnt/backup
umount: /mnt/backup: not found
#
That is the code and the error, is anyone able to help out??
Thanks,
Dennis