[HPADM] Script to copy /home

From: brian irvin (brian944us_at_yahoo.com)
Date: 10/21/04

  • Next message: Eric Berg: "[HPADM] Re: Script to copy /home"
    Date: Thu, 21 Oct 2004 11:10:19 -0700 (PDT)
    To: hpux-admin@dutchworks.nl
    
    

    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)
    

  • Next message: Eric Berg: "[HPADM] Re: Script to copy /home"

    Relevant Pages

    • Re: "pool" a tightly controlled set of Excel instances
      ... Brian, microsoft has acknowledged the problem, and provided ... an actX object to call the api, ... possibility, I suggest using DynaWrap, which will allow ... you to call api's from script. ...
      (microsoft.public.scripting.vbscript)
    • Re: Script Error
      ... Brian, Thank you for your responce, it is very helpfull, I am learning here ... with the script for Internet Exployer thanks to you. ... You are right about the restore point I should have thought about ...
      (microsoft.public.windowsxp.basics)
    • Re: [PHP] strange include path error
      ... On Wed, June 27, 2007 6:59 pm, brian wrote: ... Looking at the error log, i found that the DB connection script that's ... i recieved the mail after my client split for a long ...
      (php.general)
    • Re: Console application exporting COM interface?
      ... Well...thanks brian for the shakeup. ... I already have some C code that I want to use from a VB script. ... Can you pls guide me to a tutorial abt starting an ATL ... >> find the details since all the tutorials point to the inner workings of ...
      (microsoft.public.vc.atl)
    • Re: reading a var from another file
      ... > Brian wrote: ... >>>becomes one script and then you won't need to pass it anywhere... ... >> this way a pop up window appears to download the zip file. ... passes the query was my first idea, but that didn't work (see my post ...
      (alt.php)