#1  
Old 12th September 2007, 07:41
andipurwito andipurwito is offline
Junior Member
 
Join Date: May 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Smile Run program with own pid

Hi all..
Can i run a program with my own pid from command prompt?
Ex: # ./myprogram [pid]
Reply With Quote
Sponsored Links
  #2  
Old 12th September 2007, 08:41
Ben Ben is offline
Moderator
 
Join Date: Jul 2006
Posts: 1,029
Thanks: 7
Thanked 62 Times in 56 Posts
Default

what do you mean with "your own pid"? Each process running gets a process id (PID) from the system. If the process ends, you won't see it anymore (e.g. in ps) and logically there is no PID anymore.

Or what do you plan to do?
Reply With Quote
  #3  
Old 12th September 2007, 10:10
andipurwito andipurwito is offline
Junior Member
 
Join Date: May 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I mean: how to run program with my own PID?
Example: ./myprogram 12345

12345 is my own PID. Is there any option from Linux kernel to obtain like this?
Reply With Quote
  #4  
Old 13th September 2007, 18:06
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,741 Times in 2,575 Posts
Default

The PIDs are assigned automatically, you can't do that yourself.

If you'd like to find out the PID of a certain process, take a look at
Code:
man pidof
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #5  
Old 17th September 2007, 03:58
andipurwito andipurwito is offline
Junior Member
 
Join Date: May 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Forgive me if this question seem stupid and wrong in how to explain.
I just want to run the same program but with many of profile in the same time. And then i will take its pid later to identify each running profile.
Example:
# myprogram profile1 &
# myprogram profile2 &
# myprogram profile3 &
How should i make this possible?
Reply With Quote
  #6  
Old 17th September 2007, 09:06
Ben Ben is offline
Moderator
 
Join Date: Jul 2006
Posts: 1,029
Thanks: 7
Thanked 62 Times in 56 Posts
 
Default

then just do sth like
Quote:
ps -aux | grep "yourprogrammcall"
And split the string (sry i am no bash expert for splitting strings ) and grep the pid for that progammcall.
Maybe you have to add an
grep -v "grep \"yourpgroammcall\""
so that the grep call does not exist in the output.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Fedora 4 TPS mail problem Hagforce HOWTO-Related Questions 13 10th February 2010 18:23
pop3 service alone is failed in "The Perfect Setup - Debian Sarge (3.1)" nandhu HOWTO-Related Questions 60 5th August 2008 15:15
Make webstats run mphayesuk General 1 20th September 2006 18:14
Cannot run systemimager KCPoole HOWTO-Related Questions 1 6th May 2006 15:02
Xen 3.0 on Debian 3.1 (Sarge) kbrown20 Installation/Configuration 11 2nd May 2006 18:43


All times are GMT +2. The time now is 12:03.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.