LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-10-2008, 12:32 PM   #1
helsing
LQ Newbie
 
Registered: Feb 2008
Posts: 11

Rep: Reputation: 0
get the pid of a a specific instance of the same program


hello,

i am using wget to capture mp3 streams. how can i get the pid of the wget i just called so i can record that pid in a db or file and eventually kill that wget from another script. if i have several processes running/streams recording calling pidof wget will return the pids of all the wgets and not a specific one.

or can i get the pid of a wget by using the parameters that initially called the wget so i don't have to pass ids between scripts.

i hope this makes sense


steve
 
Old 03-10-2008, 01:01 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,332
Blog Entries: 55

Rep: Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533
"$!" will hold the PID of the process previously executed, else 'pgrep' allows selection with globbing using "-f", so 'pgrep -d ' ' -f 'wget.*.*010101.mp3' should get all instances of the wget command where also one of the arguments also has "010101.mp3".
 
Old 03-10-2008, 01:10 PM   #3
helsing
LQ Newbie
 
Registered: Feb 2008
Posts: 11

Original Poster
Rep: Reputation: 0
wicked, thanks!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
restricting multiple instance of a program V_Ganesh Programming 14 01-23-2008 11:42 AM
Killing a specific instance of a program created by a script derriva Programming 2 12-27-2006 05:42 AM
How do I get PID info about a specific script? Stepaj47 Linux - Newbie 2 11-14-2005 05:31 PM
limit program to one instance stevenhasty Slackware 2 10-28-2003 05:38 PM
How to find instance of a program mayankjohri Programming 4 12-10-2002 12:39 AM


All times are GMT -5. The time now is 08:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration