Hello,
I want to check with a ksh script if another process is running and get the process id, too. Also, I am able to get the following line:
userid 2345 1 0 13:58:52 pts/tg 0:00 abcd -a devl -f /home/cfg/abcd.cfg
How can I retrieve the pid value - 2345 - and assign it to a local variable? I tried this unsuccessfully:
TARGET_PID=`ps -ef | grep 'abcd -a' | grep -v grep | cut -d" " -f3`
or...
TARGET_PID=`ps -ef | grep 'abcd -a' | grep -v grep | awk '{print $2}'`
Any ideas? Thank you.
I want to check with a ksh script if another process is running and get the process id, too. Also, I am able to get the following line:
userid 2345 1 0 13:58:52 pts/tg 0:00 abcd -a devl -f /home/cfg/abcd.cfg
How can I retrieve the pid value - 2345 - and assign it to a local variable? I tried this unsuccessfully:
TARGET_PID=`ps -ef | grep 'abcd -a' | grep -v grep | cut -d" " -f3`
or...
TARGET_PID=`ps -ef | grep 'abcd -a' | grep -v grep | awk '{print $2}'`
Any ideas? Thank you.