Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 11-17-2007, 09:33 AM   #1
LQ Newbie
Registered: Nov 2007
Posts: 2

Rep: Reputation: 0
what is wrong with my server backup script ?

Please help. I am new to linux. I wrote a script to run the backup on lunix machine but the job gave me an error. I am using Linux Below is the sample of my script can anyone tell me where went wrong? Thanks in advance.


dat=$(date +%d%b%y)

for HOST in devil1 devil2 devil3

ssh $HOST "tar -zcvpf $backupdir/$HOST.$dat.tgz $backuptarget --exclude "/usr/hell/DB" >> $backupdir/$HOST.backup.log.$dat "

ssh $HOST "cat $backupdir/$HOST.backup.log.$dat" >> $logdir/"$HOST.backup.log.$dat"
gzip $logdir/"$HOST.backup.log.$dat"

scp root@$HOST:$backupdir/$HOST.$dat.tgz $backupdir

# scp exits with 0 on success or >0 if an error occurred.

if [ $? -gt 0 ]; then
/var/netpage OPERATIONS -TSMS -G10.200.1.99 "$HOST scp failed"

/bin/tar ztvf $backupdir/$HOST.$dat.tgz ||/var/netpage OPERATIONS -TSMS -G10.201.2.66 "$HOST.$dat.tgz is no good"

ssh $HOST "rm -f $backupdir/*"


/bin/tar -zcvpf $backupdir/devil1.$dat.tgz /* --exclude "/usr/hell/backups/*" --exclude "/usr/hell/DB/*" --exclude "/usr/dragon/.cache/*" >> $logdir/"devil1.backup.log.$dat"

gzip $logdir/"devil1.backup.log.$dat"

/bin/tar ztvf $backupdir/devil1.$dat.tgz ||/var/netpage OPERATIONS -TSMS -G10.200.1.99 "devil1.$dat.tgz is no good"

#zip up /usr/hell/backups directory as windows bkf file is big
gzip $backupdir/*

/bin/tar -rvpf /dev/st0 $backupdir/* /usr/hell/DB/200[4-6]*/* --exclude "*log*" >> $logdir/"tape.backup.log.$dat"
/bin/gzip $logdir/"tape.backup.log.$dat"
rm -f $backupdir/*
Old 11-17-2007, 09:47 AM   #2
LQ Newbie
Registered: Jun 2003
Location: Malaysia
Posts: 5

Rep: Reputation: 0
What's the error?

This looks like a script you got somewhere on the internet. I'm assuming you've edited this script to suite your environment? For example, you must fill in appropriate host names, directory names, etc.
Old 11-20-2007, 09:18 AM   #3
LQ Newbie
Registered: Nov 2007
Posts: 2

Original Poster
Rep: Reputation: 0
The below is the error message

"$HOST scp failed"
"$HOST.$dat.tgz is no good"


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
I need a backup script for my server sneakyimp Linux - Server 4 11-13-2007 11:15 AM
Using RSync to backup a secondary off-site backup server pezdspencer Linux - Software 4 06-29-2007 04:40 PM
SCRIPT: backup defined files/dirs to FTP-server markus1982 Linux - Software 0 05-25-2003 07:06 AM
Need script to dump database, ftp file to backup server glock19 Linux - Networking 17 05-12-2003 06:56 PM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:59 AM.

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