LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 08-20-2003, 10:53 AM   #1
ck7802
LQ Newbie
 
Registered: Jul 2003
Posts: 4

Rep: Reputation: 0
Pid


ok i need to assign a pid to a program i launch it like this

./mohaa_lnxded +arg1 +arg2 +arg3....

how would i do this and assign a pid at the same time?
 
Old 08-20-2003, 10:56 AM   #2
crabboy
Senior Member
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,823

Rep: Reputation: 120Reputation: 120
You don't assign the pid; the kernel will assign your program a pid when it starts it. If your program needs the pid internally it will have to make a call to getpid to get it.
 
Old 08-20-2003, 11:05 AM   #3
ck7802
LQ Newbie
 
Registered: Jul 2003
Posts: 4

Original Poster
Rep: Reputation: 0
ok well what i want to do is a scheduled shutdown of the program but i can't figure out how to do this without knowing the pid....i can't kill all of this program because i run it multiple times and i only want to kill spacific one. how wuld i get the pid of the program seeing as it is different each time it is launched?
 
Old 08-20-2003, 12:22 PM   #4
crabboy
Senior Member
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,823

Rep: Reputation: 120Reputation: 120
How do you launch the program?

The shell variable $! will contain the pid of the process you last executed.
 
  


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
/var/run/[XXX].pid - Tcl pid code liguorir Linux - Software 1 05-20-2004 11:32 PM
rm cannot remove /var/run/atd.pid and /var/run/xdm.pid danishmr Linux - Software 1 05-04-2004 09:01 AM
ERROR: Couldn't write pid to pid file lawrencegoodman Linux - Newbie 2 02-13-2004 09:05 PM
Pid jucovschi Linux - General 3 10-02-2002 02:13 PM
How to get the PID? Steave Programming 14 10-17-2001 10:19 PM


All times are GMT -5. The time now is 10:23 AM.

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