Tuesday, September 20, 2011

To check exact PID of running process in linux.

To check exact PID of process.
Command:
ps -efa  |  grep httpd | grep -v grep | awk '{print $2}'

-----------------------------------------------------------------------------------------
#! /bin/bash

PROCNAME=$1
PIDS=`ps -efa | grep $PROCNAME | grep -v grep | awk '{ print $2 }'`
for ff in $PIDS
do
echo "$ff"
done
------------------------------------------------------------------------------------------



do chmod 777 filename

Now  you can run the command like:
e.g.
filename httpd  or filename  processname.

1 comments:

Renu said...

Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
Devops Training in electronic city