LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
LinkBack Search this Thread
Old 11-17-2007, 08:33 AM   #1
misaki14797
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 2.6.14.3. Below is the sample of my script can anyone tell me where went wrong? Thanks in advance.

#!/bin/sh

dat=$(date +%d%b%y)
logdir="/usr/local/scripts/log/backup"
backuptarget="/*"
backupdir="/usr/hell/backups"

for HOST in devil1 devil2 devil3
do

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"
fi

/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/*"

done


/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, 08:47 AM   #2
apairudin
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, 08:18 AM   #3
misaki14797
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"
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are 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 10:15 AM
Using RSync to backup a secondary off-site backup server pezdspencer Linux - Software 4 06-29-2007 03:40 PM
SCRIPT: backup defined files/dirs to FTP-server markus1982 Linux - Software 0 05-25-2003 06:06 AM
Need script to dump database, ftp file to backup server glock19 Linux - Networking 17 05-12-2003 05:56 PM


All times are GMT -5. The time now is 07:01 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration