Start a programm and get it's pid

Start a programm and get it's pid

Post by Felix Seege » Thu, 18 Apr 2002 16:32:14



Hi

I start a Java program in a script like this:

(
$JAVA_HOME/bin/java $JAVA_OPTIONS -classpath $FBS_CLASSPATH:$CLASSPATH
$VM_PARAM weblogic.Server
)  > /opt/fbs/logs/sw/console.log &> /opt/fbs/logs/sw/console.log

How can get the Pid from this java prozess so that I will be able to kill
this server if something goes wrong.

thanks
have fun
Felix

 
 
 

Start a programm and get it's pid

Post by dmc » Fri, 19 Apr 2002 03:19:17


Run "top" utility (if you have it).

HTH
DMC


Quote:> Hi

> I start a Java program in a script like this:

> (
> $JAVA_HOME/bin/java $JAVA_OPTIONS -classpath $FBS_CLASSPATH:$CLASSPATH
> $VM_PARAM weblogic.Server
> )  > /opt/fbs/logs/sw/console.log &> /opt/fbs/logs/sw/console.log

> How can get the Pid from this java prozess so that I will be able to kill
> this server if something goes wrong.

> thanks
> have fun
> Felix


 
 
 

Start a programm and get it's pid

Post by Charlie Theri » Fri, 19 Apr 2002 07:02:42


Try "echo $! > myproc.pid" to save the process id for future use.   See the
man page for sh(1) for the definition of $! (last background process).

-Charlie


> Hi

> I start a Java program in a script like this:

> (
> $JAVA_HOME/bin/java $JAVA_OPTIONS -classpath $FBS_CLASSPATH:$CLASSPATH
> $VM_PARAM weblogic.Server
> )  > /opt/fbs/logs/sw/console.log &> /opt/fbs/logs/sw/console.log

> How can get the Pid from this java prozess so that I will be able to kill
> this server if something goes wrong.

> thanks
> have fun
> Felix

 
 
 

Start a programm and get it's pid

Post by Felix Seege » Fri, 19 Apr 2002 21:28:16



> Run "top" utility (if you have it).

Yes, but I want to use the pid in a script to kill the program.
Thanks for the $!, thant is what I need.

> HTH
> DMC



>> Hi

>> I start a Java program in a script like this:

>> (
>> $JAVA_HOME/bin/java $JAVA_OPTIONS -classpath $FBS_CLASSPATH:$CLASSPATH
>> $VM_PARAM weblogic.Server
>> )  > /opt/fbs/logs/sw/console.log &> /opt/fbs/logs/sw/console.log

>> How can get the Pid from this java prozess so that I will be able to kill
>> this server if something goes wrong.

>> thanks
>> have fun
>> Felix

 
 
 

1. Getting children's PID with parent's pid?

Hi all,

     Is there a way to get children's pid, given the parent's pid in
C++, RedHat 6.2?? I'm looking for something that is similar to
getppid, getpid... instead of parsing anything from /proc or ps.

     Note that I'm not the one who fork the children...

Thanks!

- Mag

2. libstdc++

3. Getting PID at process start up time

4. my PS/2 mouse doesn't work (or my IRQ 12 ?)

5. getting PID from nohup started daemon

6. home pna adapters

7. cron problem - scheduled programm doesn't start, pls help

8. FBSD install/boot; Grub; Pri/Sec partitions?

9. Getting pid's of open fd

10. getting process's pid in a script

11. How can I programm my own 'cd' programm in C ? (emulate shell's 'cd')

12. execlp() system call and getting pid's

13. How to find children PID's given parent PID?