(OLD) (ARCHIVED) Puppy Linux Discussion Forum Forum Index (OLD) (ARCHIVED) Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info

This forum can also be accessed as http://oldforum.puppylinux.com
It is now read-only and serves only as archives.

Please register over the NEW forum
https://forum.puppylinux.com
and continue your work there. Thank you.

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups    
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 28 Sep 2020, 07:34
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
How to get Process ID of a python script?
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. View previous topic :: View next topic
Page 1 of 1 [3 Posts]  
Author Message
ITSMERSH

Joined: 02 May 2018
Posts: 911

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

Beware of the Dog ähem nic007! Wink
Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 4481
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
Tinylinux blog by wiak
Back to top
View user's profile Send private message 
ITSMERSH

Joined: 02 May 2018
Posts: 911

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

Beware of the Dog ähem nic007! Wink
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [3 Posts]  
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. 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.1235s ][ Queries: 11 (0.0805s) ][ GZIP on ]