[SunHELP] Script migration problems
Ben Ricker
sunhelp at sunhelp.org
Thu Mar 29 09:13:56 CST 2001
On 28 Mar 2001 22:49:10 -0500, Dale Ghent wrote:
> On 28 Mar 2001, Ben Ricker wrote:
>
> | I have a script which I am migrating from Redhat Linux to Solaris 8. The
> | script launches a java application. Here is the key lines from the
> | script:
> |
> | # Write the PID for this process to the pidfile.
> | echo $$ > $PIDFILE
> |
> | echo "Starting JVM..."
> | exec java org.apache.jserv.JServ $PROPERTIES $1 2>> $LOG_FILE &
> |
> | How this worked on Linux is that the "echo $$ > $PIDFILE" wrote the
> | shells PID and then the exec statement started the JVM using that same
> | PID. However, on Solaris, this does not work; I cannot get theright PID
> | into that file. It does wrtie a PID, just the wrong one. Therefore, it
> | screws with my ability to restart or stop the JVM using the script.
> |
> | Any pointers?
>
> A easy solution I guess would be to install bash in /usr/local/bin and
> then change the she-bang line in your script to referenc it (but under no
> circumstances should you REPLACE /bin/sh on Solaris with bash).
I did as you suggested but still get the same problem. I have noticed
that every time, the PID written to the file is the JVM's real PID
subtract 3...a BIG kludge would be to take the PID and subtract 3 from
it. But that is not really a good idea.
Anyway to kill a process based upon name? I know Linux has 'killall
<processname>' and this would be perfect (albeit inelegant).
Thanks for the input,
Ben Ricker
More information about the SunHELP
mailing list