One possible solution is to create a file containing the PID of the process.
On Linux, the right place to store that would be /var/run/myprogram.pid
Make sure to use the Java remove on exit feature when creating the file
so that you don't have left over files. You should also use the
atomic creat
On Wed, 15 Nov 2000, Francisco Gongora wrote:
> Hello:
>
> We want our application to start automatically at boot, or stop when the
> system shuts down. We are using a startup script ( /etc/rc.d/init.d ) for
> that. After we start the java application (jar), we cannot find the name of
> the pr
In the shell script, you can get the process id of the process last started IN
THE BACKGROUND.
It is a shell variable.
In ksh the variable is $!.
The idea is to write this value into a file associated with your application.
Something like:
java myclass &
echo $! > myclass.pid
Now the file mycla