Is there any way I can change process name from ksh in Linux/AIX?

114 Views Asked by At

Is there any way I can change process name from ksh to something like script name 'lx_dequeue'. We have an monitoring application running on AIX server , and its role is to monitor processes . But it is unable to monitor some processes as our monitoring application uses Java Sigar API ,and its failing to get PID of process searching by name 'lx_dequeue' . 'lx_dequeue' is a shell script which is started using '/oracle/oracle8/bin/lx_dequeue' .

Sigar API can detect PID of process by searching keyword "ksh" but not "lx_dequeue" . We can't use "ksh" as our search keyword , as lot of other processes have same process name 'ksh' i need this changed to "lx_dequeue" only for this specific process . How can I do it , is there any possible way?

When process is running , ps -e shows as ,

# ps -e | grep 64356914
 64356914      -  0:00 ksh

And ps -ef as,

# ps -ef | grep -i "lx_dequeue"
mxuser 64356914        1   0   Jun 04      -  0:00 /bin/ksh /oracle/oracle8/bin/lx_dequeue

UPDATES: Issue is resolved after going through Sigar API documentation . I Changed process search expression as below and it worked . FROM: State.Name.sw=lx_dequeue TO: State.Name.sw=ksh,Args.-1.ct=lx_dequeue

1

There are 1 best solutions below

0
On

No. You'll need to find a way to instruct the Sigar API to use a combination of process name and arguments to reliably find the lx_dequeue process.

https://unix.stackexchange.com/a/119991/117549 goes into more detail, but when the lx_dequeue script is invoked, the system finds the #!/bin/ksh sh-bang line and re-invokes ksh with the lx_dequeue script as its argument. This is the final process that you see executing: the ksh shell executing commands from that file.

If you can customize the Sigar API search, this awk statement should help pin down that process:

ps -eo comm,args | awk '$2 == "/bin/ksh" && $3 == "/oracle/oracle8/bin/lx_dequeue"'