LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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, 09: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, 09:56 AM   #2
crabboy
Senior Member
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,821

Rep: Reputation: 121Reputation: 121
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, 10: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, 11:22 AM   #4
crabboy
Senior Member
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,821

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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:53 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
Open Source Consulting | Domain Registration