[lug] More script questions

Chip Atkinson chip at pupman.com
Thu Apr 27 18:08:48 MDT 2000


Bill,

Sorry about the potential flurry of messages I may have just sent.  I
think I got the script working.  Here's what I have:  
---------------------------- 
#! /bin/sh


testl1=0
testl2=1

while [ $testl1 != $testl2 ]; do

  p1="`ps x|awk '/program/ {print $1}' |head -1`"
  p2="`ps x|awk '/program/ {print $1}' |head -2 |tail -1`"

  if [ $((p1 + 2)) = $((p2)) ]; then
    echo " Program Is Down!!" 
    testl1=0    
  else
    echo "Test failed."
    testl2=1     
  fi
  sleep 5
done
----------------------------------
On Thu, 27 Apr 2000, winrip wrote:

> OK wel I figured out a way to do it so far, by the way thanks for the
> responses. However I need someone to look this over I get an "syntax error near
> unexpected token `do' " message.
> 
> Anyway I got this far but I can't figure this last error out. 
> 
> #! /bin/sh
> 
> testl1 = 0
> testl2 = 1
> 
>  while [testl1 != testl2]
> 
> p1 = "`ps x|awk '/program/ {print $1}' |head -1`"
> p2 = "`ps x|awk '/program/ {print $1}' |head -2 |tail -1`"
> 
>     if [p1 + 2 == p2]; then
>     echo " Program Is Down!!" |mail winrip at p2.winrip.cx
>     testl1 = 0 
>     else
>    testl2 = 1 
>    fi
> do 
> sleep 5
> done
> 
> 
> echo "done for now"
> 
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> 






More information about the LUG mailing list