Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 14 Nov 2018, 22:50
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
How to get Process ID of a python script?
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [3 Posts]  
Author Message
ITSMERSH


Joined: 02 May 2018
Posts: 450

PostPosted: Thu 05 Jul 2018, 16:04    Post subject:  How to get Process ID of a python script?  

Hi.

Does anyone know how to find out the process ID of a python script?

I need to check if jack_mixer is running, so I need something that returns the process ID of jack_mixer, which is a python script.

Thanks in advance,

RSH

_________________
RSH
Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 3532
Location: holland

PostPosted: Thu 05 Jul 2018, 16:37    Post subject: Re: How to get Process ID of a python script?  

ITSMERSH wrote:
Hi.

Does anyone know how to find out the process ID of a python script?

I need to check if jack_mixer is running, so I need something that returns the process ID of jack_mixer, which is a python script.

Thanks in advance,

RSH


Can't test, but I'd say this could do:
Code:
pidjack_mixer=$(ps -eo pid,cmd | grep -v grep | grep "jack_mixer" | awk '{ print $1 }')
echo $pidjack_mixer


Fred

_________________
Dog Linux website
Back to top
View user's profile Send private message 
ITSMERSH


Joined: 02 May 2018
Posts: 450

PostPosted: Thu 05 Jul 2018, 18:15    Post subject: Re: How to get Process ID of a python script?  

fredx181 wrote:
ITSMERSH wrote:
Hi.

Does anyone know how to find out the process ID of a python script?

I need to check if jack_mixer is running, so I need something that returns the process ID of jack_mixer, which is a python script.

Thanks in advance,

RSH


Can't test, but I'd say this could do:
Code:
pidjack_mixer=$(ps -eo pid,cmd | grep -v grep | grep "jack_mixer" | awk '{ print $1 }')
echo $pidjack_mixer

Fred

This seems to work very well.

Thanks! Very Happy

_________________
RSH
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [3 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0399s ][ Queries: 12 (0.0097s) ][ GZIP on ]