[prev in list] [next in list] [prev in thread] [next in thread] 

List:       hpux-admin
Subject:    [HPADM] Script to copy /home
From:       brian irvin <brian944us () yahoo ! com>
Date:       2004-10-21 18:10:19
Message-ID: 20041021181019.49218.qmail () web20926 ! mail ! yahoo ! com
[Download RAW message or body]

Team:

I am writing a small script to copy the home dir's
from 3 machines. Pl find my script below..Please help
if there are any mistakes..My first attempt..


#!/usr/bin/sh

###################################################################
 # SCRIPT NAME  : HomeBackup.sh
 # AUTHOR       : Brian
 # DATE         :
 # VERSION NO   : 1.0 
 # PURPOSE      : This script takes backup of /home
Machines ns1, ns2, ns3 to /home directories to as50
server.
 #


PATH=$PATH:/usr/bin:/usr/sbin:/usrlocal/bin:/usr/contrib/bin:/opt/perf/bin
export TERM=vt100
export PATH

LOG_FILE=/tmp/HomeBackup.log
exec >> $LOG_FILE 2>&1

ns1_Home_Size=`remsh ns1 /usr/bin/bdf |grep home |awk
'{ if ($6 == "/home") print $3 }'`
if [ $? -eq 1 ]
then 
	echo "`date '+%D %T'` ns1 remote execution permission
is not available"
	exit 1
fi

ns2_Home_Size=`remsh ns2 /usr/bin/bdf |grep home |awk
'{ if ($6 == "/home") print $3 }'`
if [ $? -eq 1 ]
then 
	echo "`date '+%D %T'` ns2 remote execution permission
is not available"
	exit 1
fi
ns3_Home_Size=`remsh ns3 /usr/bin/bdf |grep home |awk
'{ if ($6 == "/home") print $3 }'`
if [ $? -eq 1 ]
then 
	echo "`date '+%D %T'` ns3 remote execution permission
is not available"
	exit 1
fi
Total_used_space=`expr $ns1_Home_Size + $ns2_Home_Size
+ $ns3_Home_Size`
Availed_space=`/usr/bin/bdf |grep depot|awk '{ if ($6
== "/depot") print $4 }'`


# Check free space is available on as50:/depot
if [ $Availed_space -lt $Total_used_space  ]
then
	echo "`date '+%D %T'` Error: There is not enough
space under /depot "
	exit 1
fi

#Copy ns1 /home directory to as50:/depot/ns1
if [ -f /home/ns1/home ]
then
	rcp -rp ns1/home /depot/ns1/home
fi

#Copy ns2 /home directory to as50:/depot/ns2
if [ -f /home/ns2/home ]
then
	rcp -rp ns2:/home /depot/ns2/home
fi

#Copy ns3 /home directory to as50:/depot/ns3
if [ -f /home/ns3/home ]
then
	rcp -rp ns3:/home /depot/ns3/home
fi

My questions:

Is rcp a good approach or can i use fbackup etc..

Is there anyhting wrong with the script?

Please Help

Best Regards

Brian



		
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

--
             ---> Please post QUESTIONS and SUMMARIES only!! <---
        To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
       Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl
 
 Archives:  ftp.dutchworks.nl/pub/digests/hpux-admin       (FTP, browse only)
            http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic