The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Operating Systems > Linux
.
google unix.com



Linux RedHat, Ubuntu, SUSE, Fedora, Debian, Mandriva, Slackware, Gentoo linux, PCLinuxOS. All Linux questions here!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Full System Backup Sco 5.0.5 nellenodrog UNIX for Dummies Questions & Answers 2 01-23-2009 12:22 PM
full system backup mm00123 SUN Solaris 1 04-17-2008 02:30 AM
Full backup and Restore Basha SUN Solaris 16 01-08-2008 07:39 PM
System full backup to tape Tlg13team UNIX for Dummies Questions & Answers 0 12-20-2007 04:43 AM
Full System Backup / Cloning HPUX real-chess UNIX for Dummies Questions & Answers 0 08-12-2006 09:26 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 11-17-2007
clement clement is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 4
full system 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/*
 

Bookmarks

Tags
linux

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:52 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0