pidmon

Name

pidmon - Searches the process list for a command string or takes the OpState from a file.

Synopsis

pidmon [-h] [-d debugmode] [-u uid] [-c] command_string

pidmon [-h] [-d debugmode] -f opstate_file

Description

The pidmon command searches the process list for a command string. If the command string was found, the RMC OpState Online is returned. The pidmon command can be used as a generic monitor for the IBM.Application resource class. Optionally the RMC OpState can be taken from a specified file.

Options

-h
Writes the command's usage statement to standard output.
-d debugmode
Specifies the debug mode.
-u uid
Specifies a user ID for the command string search.
-c
Command string search (default) - the string can contain wildcards such as *; the matching rules follow the POSIX function fnmatch().
-f
OpState is taken from file.

Parameters

debugmode
Can be one of the following options:
1
Write debug messages to syslog.
2
Write debug messages to standard output/error.
3
Write detailed debug messages to standard output/error and syslog.
uid
Searches process list for command string, which belongs to the specified user id. RMC_ OPSTATE_ ONLINE is only reported if there is a process with the specified command string and owner of this process is uid.
opstate_file
Plain text file that contais just one of the RMC OpStates shown below. The pidmon command reads this text file and returns OpState from the file.

Exit Status

Against usual command convention pidmon does not return 0 on success or another value on error. It returns the RMC OpState. An exit status of 0 means RMC_OPSTATE_UNKNOWN, which indicates an error in the pidmon command. Valid RMC OpStates:
0
RMC_OPSTATE_UNKNOWN
1
RMC_OPSTATE_ONLINE
2
RMC_OPSTATE_OFFLINE
3
RMC_OPSTATE_FAILED_OFFLINE
4
RMC_OPSTATE_STUCK_ONLINE
5
RMC_OPSTATE_PENDING_ONLINE
6
RMC_OPSTATE_PENDING_OFFLINE
8
RMC_OPSTATE_INELIGIBLE

Security

This command does not require special permissions.

Examples

  1. Searches for the process with the command string '/bin /bash' and returns OpState online (exit status 1).
    pidmon '/bin/bash/'
    echo $?
    1
  2. Searches for the process with the command string that contains "java"; there is at least one process with a command string that contains "java", so pidmon returns the OpState online (exit status 1).
    pidmon '*java*'
    echo $?
    1
  3. pidmon reads myopstate file, which contains only the number '3', and returns OpState failed offline (exit status 3).
    pidmon -f myopstate
    echo $?
    3
  4. Use the pidmon command as a generic monitor command for an IBM.Application resource definition:
    lsrsrc -s "Name='syslogd'" IBM.Application
    resource 1:
      Name              = "syslogd"
      ResourceType      = 0 
      AggregateResource = "0x3fff 0xffff 0x00000000 0x00000000 
    									  0x00000000 0x00000000"
      StartCommand      = "/etc/init.d/syslog start"
      StopCommand       = "/etc/init.d/syslog stop"
      MonitorCommand    = "/usr/sbin/rsct/bin/pidmon '/sbin/syslogd'"
      ....

Files

/usr/sbin/rsct/bin/pidmon
Location of the pidmon command.

See Also

The MonitorCommand attribute of IBM.Application as described under Attributes used by IBM.Application in .