Hi All,
Tried with subprocess,it worked
def findThisProcess( process_name ):
ps = subprocess.Popen("ps -ef |grep "+process_name+"|egrep -v
'sh|grep'|awk -F ' ' {'print $2'}", shell=True, stdout=subprocess.PIPE)
output = ps.stdout.read()
ps.stdout.close()
ps.wait()
print output
On Thu, Jan 30, 2014 at 2:12 PM, Udaya Kumar <[email protected]> wrote:
> On Wed, Jan 29, 2014 at 6:16 PM, hari prasadh <[email protected]
> >wrote:
>
> > In python
> > >>> import os
> > >>> os.popen("ps -ef |grep jboss").read()
> > 'root 24452 24425 0 17:34 pts/0 00:00:00 sh
> > /root/jboss-as-7.1.1.Final/bi\nroot 24593 24592 0 17:34 pts/0
> > 00:00:00 sh -c ps -ef |grep jboss\nroot 24595 24593 0 17:34 pts/0
> > 00:00:00 grep jboss\n'
> >
> >
> >
> It might be due to terminal width. Try setting it with os.environ. Also
> popen is deprecated, use subprocess.
> _______________________________________________
> ILUGC Mailing List:
> http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
> ILUGC Mailing List Guidelines:
> http://ilugc.in/mailinglist-guidelines
>
--
Thanks & Regards,
HariPrasadh
_______________________________________________
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
ILUGC Mailing List Guidelines:
http://ilugc.in/mailinglist-guidelines