Forum Discussion

1 Reply

  • this is what i got so far.

     

    !/bin/bash key_msg="succ_cnt=1"

    ' if user does not provide correct amount of arugments, show them correct way to run it and end program. '

     

    if [ $ -ne 2 ]; then echo "incorrect number of arguments given. run script as follows:" echo "./up.sh hostname username" exit 1 fi

    ' run adtest command. $1 is the host, $2 is the username. both are read from the command line '

     

    echo "enter password" OUTPUT="$(adtest -t auth -d 10 -h $1 -r ct.chevrontexaco.net -u $2)"

    ' if you want to see full output of the command, uncomment the following section '

     

    ' echo "============================================" echo "$OUTPUT" echo "============================================" '

    ' if the output contains the key_msg ("succ_cnt=1"), then UP, else DOWN '

     

    echo "${OUTPUT}" | grep -q "$key_msg" && echo "UP" || echo "DOWN"