Topic
  • 2 replies
  • Latest Post - ‏2010-08-20T16:22:18Z by Kosala
apple08
apple08
241 Posts

Pinned topic automate mksysb using NIM via cron job

‏2010-08-20T06:34:18Z |
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
Updated on 2010-08-20T16:22:18Z at 2010-08-20T16:22:18Z by Kosala
  • jklotz
    jklotz
    26 Posts

    Re: automate mksysb using NIM via cron job

    ‏2010-08-20T13:49:02Z  
    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.
  • Kosala
    Kosala
    141 Posts

    Re: automate mksysb using NIM via cron job

    ‏2010-08-20T16:22:18Z  
    • jklotz
    • ‏2010-08-20T13:49:02Z
    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.
    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