AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.


#Power
 View Only
  • 1.  automate mksysb using NIM via cron job

    Posted Fri August 20, 2010 02:34 AM

    Originally posted by: apple08


    Dear All,
    how to automate mksysb using NIM via cron job (define resource etc). I would like to cron the mksysb so that no need server admin to be onsite.
    Hope to hear from you. Many thanks
    #AIX-Forum


  • 2.  Re: automate mksysb using NIM via cron job

    Posted Fri August 20, 2010 09:49 AM

    Originally posted by: jklotz


    You could schedule a script like this one from the crontab :
    for mach in $(lsnim -c machines | grep -v ^master | awk '{print $1}')
    do
    echo "Working on $mach ..."
    # removes the mksysb
    nim -o remove ${mach}_mksysb
    # generates a new one
    nim -o define -t mksysb -a server=master -a location=/export/nim/mksysb/${mach}_mksysb -a source=$mach -a mk_image=yes -a mksysb_flags="-i -m -e" -F ${mach}_mksysb
    if $? != 0
    then
    echo "Mksysb error on ${mach}"
    fi
    done
    Another option could be to have each remote system create the mksysb at a given time, and download it from the nim master with a ftp or scp.
    #AIX-Forum


  • 3.  Re: automate mksysb using NIM via cron job

    Posted Fri August 20, 2010 12:22 PM

    Originally posted by: Kosala


    Yep... I've done this successfully. But like to add couple of things....

    lsnim -t standalone will list all the defined standalone machines.

    Defining exclude_files resource will come handy.
    Rather than directly replacing the mksysb resource, I used a temporary resource first. E.g.

    <script>
    -f /export/nim/mksysb/tmp1 && rm /export/nim/mksysb/tmp1
    nim -F -o remove tmp
    nim -o define -t mksysb -a server=master -a location=/export/nim/mksysb/tmp1 -a source=$mach -a mk_image=yes tmp
    $? == 0 && {
    mv /export/nim/mksysb/tmp1 /export/nim/mksysb/${mach}_mksysb
    nim -o define -a location=/export/nim/mksysb/${mach}_mksysb ${mach}_mksysb
    }
    </script>

    This will make sure that you have at least one good backup of each machine if something goes wrong with the new mksysb operation. Conceptually this is the same as jklotz mentioned, except for the reassurance of the backup.

    Kosala
    #AIX-Forum