[SunHELP] Script migration problems
Nicholas Dronen
sunhelp at sunhelp.org
Thu Mar 29 10:56:16 CST 2001
On Thu, Mar 29, 2001 at 09:13:56AM -0600, Ben Ricker wrote:
> 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.
This could be a difference between implementations of the JVM on
Linux and Solaris. Perhaps the JVM on Solaris does a fork()/exec()
of another file, and the parent of that process calls exit().
Truss -fall would confirm this.
Regards,
Nicholas
More information about the SunHELP
mailing list