LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-29-2004, 08:06 AM   #1
dennis_89
LQ Newbie
 
Registered: Jun 2004
Posts: 27

Rep: Reputation: 15
help with backup script


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
 
Old 06-29-2004, 09:43 AM   #2
init
Member
 
Registered: Oct 2003
Location: Portland, Maine
Distribution: Gentoo 2004_2 2.6.7r14
Posts: 160

Rep: Reputation: 30
A guess for ya,

Put /mnt/backup in your fstab and make sure the directory is created under /mnt

I assuming this /mnt/backup is on a differnt machine a samba share.

Code:
$USERNAME1=username
$PASSWORD1=password
$TARGET_MACHINE=target_machine_name
also I dont think you want a $ in front of you variables at this point in time in the script

Here you are just setting the variables later you use them in which you would use the $USERNAME1 and such....

like i siad just a guess, feel free to slap me if i am wrong
 
Old 06-29-2004, 09:47 AM   #3
dennis_89
LQ Newbie
 
Registered: Jun 2004
Posts: 27

Original Poster
Rep: Reputation: 15
yup, definitely have to lose the $.

Thanks,

Dennis
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Backup script raptorman Programming 4 08-22-2005 09:52 AM
What backup script do you use? buldir Linux - Software 1 04-12-2005 02:57 PM
Need a backup script enygma Linux - General 5 11-04-2004 03:49 PM
Script Backup Buto Linux - General 2 10-18-2004 05:56 PM
Backup Script imsajjadali Linux - General 7 01-28-2004 03:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration