The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Showing Device Does Not Exist While Taking Backup ailnilanjan UNIX for Advanced & Expert Users 3 09-28-2007 09:14 AM
remote monitoring of device by telnet ILA Shell Programming and Scripting 1 12-31-2004 07:38 AM
backup with CPIO alisevA3 UNIX for Dummies Questions & Answers 1 06-05-2004 12:59 AM
Backup system to NFS Appliance device sirhisss UNIX for Dummies Questions & Answers 10 09-03-2003 12:24 PM
backup listing(cpio) Prafulla UNIX for Dummies Questions & Answers 1 10-10-2001 11:48 AM

Closed Thread
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
  #1 (permalink)  
Old 07-17-2002
Cameron's Avatar
Cameron Cameron is offline Forum Advisor  
Registered User
  
 

Join Date: Nov 2001
Location: Brisbane, Australia
Posts: 500
cpio backup to a remote device..

Hi,

Needing to perform a backup of one system to the tape unit on another system. Why, well because the local tape device is stuffed and I desparately need to have a backup completed successfully sooner rather than not at all.

My question is how do I set the below code to allow me to perform the cpio command to write to the everest_backup: server's /dev/nrStp0 device?

Code:
:
state=`cat /etc/MSTATE`; if [ $state != "master" ]; then exit 0;fi
umask 0
DIRECTORY=/u/backup
export DIRECTORY
DEVICE1=everest_backup:/dev/rStp0
DEVICE2=everest_backup:/dev/nrStp0
CPIOCMD="cpio -ovcB > $DEVICE2"
FILE=nite`date '+%d'`
STATUS="OK"
export FILE

## **** Comment the below two(2) lines ONLY when testing ****
#/u/everest/cron/rcp_trans_logs_daily.sh
#/u1/everestnz/cron/rcp_trans_logs_daily.sh

# If a different directory or file name is required for the backup,
# changed the above lines only.
# Check for the existance of backup directory.
# If it doesn't exist, create it. The logfile will be created automatically.

exit_print ()
{
        if [ $* -gt 0 ]
          then
            STATUS=FAULTY
        fi
#       echo "Exit Code: $*" >> $LOGFILE

        cat $LOGFILE | \
        mail -s"$STATUS backup of TVL(EVEREST) on Everest-backup." ops@somedomain.com.au
        exit 0
}

if [ ! -d $DIRECTORY ]
then
        mkdir $DIRECTORY
fi

LOGFILE=$DIRECTORY/$FILE
LOGFILE_DETAIL=$DIRECTORY/"$FILE"_DETAIL

# Remove all core and enc files from directories being backed up.
# find /usr/acct \( -name core -o -name '*.enc' \) -print | xargs /bin/rm -f &
# Remove all core from system.
# The following command has been # out as it took over 1&half hours to complete

# run from cron every week instead
#find / -name core -print | xargs /bin/rm -f

# Remove enc files from directories being backed up.

echo "" > $LOGFILE
echo "" > $LOGFILE_DETAIL
echo "Backup of everest commenced  "`date` >> $LOGFILE
echo "" >> $LOGFILE

# Retension tape
echo "** Backup Start using cpio command:"
echo "**       '"$CPIOCMD"'."
echo "** Rewinding Tape Device: "$DEVICE1
tape rewind $DEVICE1
echo "** Rewinding Tape Device: "$DEVICE1
tape rewind $DEVICE1
echo "** Sleeping (20)"
sleep 20
echo "** Rewinding Tape Device: "$DEVICE1
tape rewind $DEVICE1
ERROR="$?"
echo "** Error Result of Rewind: "$ERROR
case $ERROR in
  0) ;;
  *) echo " " >> $LOGFILE
     echo "**** WARNING ****" >> $LOGFILE
     echo "Cannot retension tape. Backup Aborted." >> $LOGFILE
     echo "    Error Status = $ERROR" >> $LOGFILE
     exit_print $ERROR ;;
esac

cd /
marker=0
errcount=0

# "/x1" used for testing.
#for shit in "/x1"
#for shit in "/" "/stand" "/u" "/u1" "/u2"
#for shit in "/" "/stand" "/u" "/u1" "/u2" "/x1"

for shit in "/x1"
  do
    echo "**** Changing To Directory: "$shit
    cd $shit
    echo "**** File marker $marker filesystem "$shit
    echo "File marker $marker filesystem $shit" >> $LOGFILE
    date >> $LOGFILE

    #ps -ef >> $LOGFILE_DETAIL
    #fuser $shit >> $LOGFILE_DETAIL

    echo " " >> $LOGFILE_DETAIL
    if  [ `date +'%u'` -ge 1 -a `date +'%u'` -le 5 ]
      then
        #incremental backup mon to fri

        echo "**** Backup of "$shit" Commenced. ( "`date '+%R'`" )"
        find . -mtime -14 -mount -depth -print | \
          $CPIOCMD \
            2>> $LOGFILE_DETAIL
        echo "**** Backup of "$shit" Completed.( "$?" )"

        ## - Revert to Full-Backups as of 19/04/02 - requested by Anish (TVL)
        ##  find . -mount -depth -print |cpio -ovcB >$DEVICE1 \
        ##   2>> $LOGFILE_DETAIL

        ##  find . -mount -depth -print | \
        ##  cpio -ovcC32768 | dd of=$DEVICE1 conv=bmode bs=32k \
        ##    2>> $LOGFILE_DETAIL

      else
        #full backup sat/sun
        ##find . -mount -depth -print | \
        ##  cpio -ovcB >$DEVICE1 2>> $LOGFILE_DETAIL
        find . -mount -depth -print | \
          cpio -ovcC32768 | dd of=$DEVICE1 conv=bmode bs=32k \
            2>> $LOGFILE_DETAIL

    fi
  ERROR="$?"
  marker=`expr $marker + 1`
  errcount=`expr $errcount + $ERROR`
done

ERROR=$errcount
echo " " >> $LOGFILE

# Test for success of backup.
case $ERROR in
        0) echo "Backup successful .... Phew!" >> $LOGFILE ;;
        *) echo "** WARNING ** Backup unsuccessful ended "`date` >> $LOGFILE
        case $ERROR in
        2)  echo " PROBLEM WITH TAPE DRIVE" >> $LOGFILE
            exit_print $ERROR ;;
        4)  echo " INTERRUPTED SYSTEM CALL" >> $LOGFILE
            exit_print $ERROR ;;
        5)  echo "          I/O ERROR" >> $LOGFILE
            exit_print $ERROR ;;
        6)  echo " NO SUCH DEVICE1 OR ADDRESS" >> $LOGFILE
            exit_print $ERROR ;;
        7)  echo " ARGUMENT LIST TOO LONG" >> $LOGFILE
            exit_print $ERROR ;;
        11) echo " NO MORE PROCESSES" >> $LOGFILE
            exit_print $ERROR ;;
        12) echo " NOT ENOUGH SPACE" >> $LOGFILE
            exit_print $ERROR ;;
        13) echo " PERMISSION DENIED" >> $LOGFILE
            exit_print $ERROR ;;
        28) echo " NO SPACE ON DEVICE1" >> $LOGFILE
            exit_print $ERROR ;;
        *)  echo "    ** Aborting **" >> $LOGFILE
            echo "    Error Status = $ERROR"  >> $LOGFILE
            exit_print $ERROR ;;
        esac ;;
esac

echo "  " >> $LOGFILE
echo " End Time:     "`date '+%H:%M:%S'` >> $LOGFILE
echo " " >> $LOGFILE

echo "** Getting Status of  Tape Device: "$DEVICE1
tape status $DEVICE1 >> $LOGFILE
echo "** Rewinding Tape Device: "$DEVICE1
tape rewind $DEVICE1
echo "** Unloading Tape Device: "$DEVICE1
tape unload $DEVICE1
echo " Rewind completed:     "`date '+%H:%M:%S'` >> $LOGFILE
echo " " >> $LOGFILE
# Test for successful read of tape. If not successful, end script.
echo " " >> $LOGFILE
echo "BACKUP OF BOOKING ENGINE  COMPLETED AT "`date` >> $LOGFILE
exit_print 0
  #2 (permalink)  
Old 08-15-2002
miredale miredale is offline
Registered User
  
 

Join Date: Aug 2002
Location: UK
Posts: 44
have you updated the .rhosts file on both servers ?
  #3 (permalink)  
Old 08-15-2002
Cameron's Avatar
Cameron Cameron is offline Forum Advisor  
Registered User
  
 

Join Date: Nov 2001
Location: Brisbane, Australia
Posts: 500
Yep, both updated.

Could I be missing something in the script??
  #4 (permalink)  
Old 08-15-2002
RTM's Avatar
RTM RTM is offline Forum Advisor  
Hog Hunter
  
 

Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
First - look to insure you can 'go both ways'

On system everest (the one with the tape drive) do a
% rsh systemX uptime

as the user who will be running the script. Then go from systemX (the one to be backed up) to system Everest.
% rsh everest_backup uptime

If you get a response both ways of the output of the uptime command (or one of your favorites) then the next problem is permissions on the tape drive. If you get permission denied, then there is still a problem with trust between the servers. That is usually the problem - check your /etc/hosts.equiv files or appropriate rhost files for the user and servers.

It's possible that a regular user can't backup to the tape drive. Sign in as the user that will be running the job on the client. See if you can manually cpio to the tape drive on everest.

If this all works, then run the script manually. If it works - run in cron.

Post back results for all test.
Closed Thread

Bookmarks

Tags
cpio

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:11 PM.


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