[HPADM] Summary: ps scripting help

From: Ken Felmly (kfelmly_at_h40a.resva.trw.com)
Date: 05/14/03

  • Next message: Enrico Nicolis: "[HPADM] [SUMMARY] swmodify error"
    Date: Wed, 14 May 2003 16:35:35 -0400
    To: "hpux-admin@dutchworks.nl" <hpux-admin@dutchworks.nl>
    
    

    Sorry for the late summary:
    Essentiallt I removed the 2nd $ in $PROCESS$ and it works now.

    Thanks for all of the very helpful replies.
    Kenny

    This is my script:
    #!/usr/sbin/sh
    MUSTRUN="LISTENER"
    while true
    do
    ALLPROCS=`ps -ef`
       for PROCESS in $MUSTRUN
       do
           echo "$ALLPROCS" | grep -q " $PROCESS$"
           if [ $? -eq 1 ]
           then
               echo "$PROCESS not running!"
               <other commands...>
           fi
       done
    done

    Original post:
    More information:
    I have a 2-node cluster with 3 SIDs. 2 are 8.0.6 and 1 is 8.1.7. I
    need to run 3 seperate listeners so that when any of the SIDs die, then
    the adoptive node gets the SID with its associated listener. In other
    words, when package 2 fails, I don't want the listener shutdown for the
    other SIDs.

    What I am confused about is that the ps -ef | grep -q returns a 0 for
    running processes that end with the name I am grepping for where the
    processes that have the name within the output (not the last field) it
    returns a 1.

    In essence a server could be running 3 different listeners on different
    services ports and I don't want 1 package to shutdown all of the
    listeners if the other 2 are ok.
    I am trying to run a monitor script that checks for all the Oracle sids
    and the listener.

    MUSTRUN = "ora_pmon ora_smon ora_lgwr LISTENER"
    ALLPROCS=`ps -ef`

    the ps -ef |grep -q " $Process$ returns a 0 for all the "ora_" but the
    LISTENER returns a 1 blowing out the script.

    Near as I can figure, the ps -ef only sees the last entry in the ps -ef
    command (field 9).
    When I put the word "-inherit" (field 10) the script returns a 0 for all
    procs.

    --
                 ---> Please post QUESTIONS and SUMMARIES only!! <---
            To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
           Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl
     
     Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse only)
                http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)
    

  • Next message: Enrico Nicolis: "[HPADM] [SUMMARY] swmodify error"

    Relevant Pages

    • [HPADM] re: ps scripting help
      ... need to run 3 seperate listeners so that when any of the SIDs die, ... the adoptive node gets the SID with its associated listener. ... running processes that end with the name I am grepping for where the ... I am trying to run a monitor script that checks for all the Oracle sids ...
      (HP-UX-Admin)
    • background process/command in a script
      ... otherwise the listener just hangs. ... My issue is that I have to put this in as the startup script for a VCS ... echo "Starting MQ Listener for $on port ...
      (SunManagers)
    • Re: Win32::Process - Limiting the number of processes launched from within a script
      ... > on the script server. ... I might try writing a listener that I could put ... on every end point that listened on say port 9010 (or some other ... some other port) to handle replies to requests sent to the listener port ...
      (comp.lang.perl.misc)
    • Re: testing for independence of 2 ordinal scales
      ... native Italian, noimpediment, ... the same script might be correlated (again, within one listener), since ...
      (sci.stat.math)
    • Re: Problem with automatic startup
      ... I have a problem with database automatic startup. ... exactly database but listener. ... I've created dbora script that looks like this: ...
      (comp.databases.oracle.server)