[SunHELP] Script migration problems

Dale Ghent sunhelp at sunhelp.org
Wed Mar 28 21:49:10 CST 2001


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?

Well, $$ is collecting the PID of the shell process itself that is running
your script. You must be running into a difference between /bin/sh on
Solaris (which is THE Bourne shell) and /bin/sh on Linux (which is
actually the GNU bash shell).

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).

/dale




More information about the SunHELP mailing list