LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-02-2002, 11:46 AM   #1
jucovschi
LQ Newbie
 
Registered: Oct 2002
Posts: 9

Rep: Reputation: 0
Pid


I write in a batch file

./myprog &

1) How can I find the PID of this program without looking for it in Process list
or Can I find the PID of this program with looking in Process list but I want to be sure it is the
one I run.



2) If I write wait %1 it give me "job control not enabled" - what can I do to enable it ?
 
Old 10-02-2002, 12:56 PM   #2
markus1982
Senior Member
 
Registered: Aug 2002
Location: Stuttgart (Germany)
Distribution: Debian/GNU Linux
Posts: 1,467

Rep: Reputation: 46
If you want to look in the proccess list yourself:
Code:
ps auxw | grep myprog

If you don't want to do that:
Code:
if test "x`pidof myprog`" != x; then
echo "Stopping myprog ..."
killproc myprog
fi
 
Old 10-02-2002, 01:07 PM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3608Reputation: 3608Reputation: 3608Reputation: 3608Reputation: 3608Reputation: 3608Reputation: 3608Reputation: 3608Reputation: 3608Reputation: 3608Reputation: 3608
1. "$$" Here's an example:
#!/bin/sh
echo "My PID is $$"; ps | grep "TEST"

2. What shell are you in?

* pidof resides in /sbin, and therefore should not be in the path of "regular" users, also the "killproc" function only works on Red Hat, and only if you source /etc/rc.d/init.d/functions.
 
Old 10-02-2002, 01:13 PM   #4
markus1982
Senior Member
 
Registered: Aug 2002
Location: Stuttgart (Germany)
Distribution: Debian/GNU Linux
Posts: 1,467

Rep: Reputation: 46
uups forgot that
 
  


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 On
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 ck7802 Linux - Newbie 3 08-20-2003 11:22 AM
How to get the PID? Steave Programming 14 10-17-2001 09:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:56 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