Re: Script help needed...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks Jonathan,

You put me on the right path.  I did the following and it works.

1. Created a function called func_catpid
func_catpid(){
    for LINE in $1
    do
        if [ -z "$LINE" ]; then
            break
        else
            #Get PID from PIDFILE
            OLDPID=`echo $LINE | awk '{ print $1 }'`
            RUNNING=`ps aux | grep $OLDPID | grep -v grep | wc -l | tr -d '
'`
            if [ $RUNNING = 0 ]; then
                R=0
            else
                (( R = $R + 1 ))
                echo "INSIDE R = $R"
                LOC=`echo $LINE | awk '{ print $2 }'`
            fi
        fi
    done
}

2. Change the cat $PIDFILE line to...
    PIDFILEINFO=`cat $PIDFILE`
    func_catpid $PIDFILEINFO

Works like a charm.

Thanks again,
--
Magnus Andersen
Systems Administrator / Oracle DBA
Walker & Associates, Inc.
-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subjecthttps://www.redhat.com/mailman/listinfo/redhat-list


[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux