Re: Solaris 7 (unix) jigsaw.server startup/shutdown script V1.8

Hello Roland,

Thank you for the script.  Here are few comments:
1. Running with a different root on my server, so I added a JIGROOT
variable which I use in the start up line.
2. Had problems with the "-host ${JIGHOST} " the 2.03 version I have does
not seem to support it.

Other than that it works fine on my Solaris 7.

thanks again,

John

At 11:46 PM 7/30/99 +0200, Roland Mainz wrote:
>
>Hi !
>
>----
>
>Here comes a new version of the jigsaw.server script (V1.8).
>
>It would be nice if someone would make some comments which platforms are
>working and which not.
>
>The script needs little modifications to set the right CLASSPATH, jigsaw's
>user/group and home directory, and the file permissions should be set to 700,
>othwise
>the admin server's password is visible to other users (security leak !!).
>
>TODO:
>- script should warn at startup (and log daemon/critical) if jigsaw was
>terminated
>    using CTRL-C etc. (see logger(1))
>- script should be rewritten to use functions
>- renaming logs at startup: the script should rename jigsaw's logfiles in the
>    syslog-style (e.g. syslog.0, syslog.1 etc.) at startup.
>    This will be an optional feature, which is usefull when the server is
>restarted
>    every night using the "restart_server" option (to get daily logs).
>
>----
>
>Bye,
>Roland
>
>--
>  __ .  . __
> (o.\ \/ /.o) Roland Mainz                               C/JAVA programmer
>  \__\/\/__/  Roland.Mainz@informatik.med.uni-giessen.de MPEG specialist
>  /O /==\ O\  gisburn@informatik.med.uni-giessen.de      Sun&Unix programmer
> (;O/ \/ \O;) TEL +49 (0) 641/99-13193  FAX +49 (0) 641/99-41359
>
>
>#!/sbin/sh
>#
># Copyright (c) 1999 by Roland Mainz
(Roland.Mainz@informatik.med.uni-giessen.de)
># All rights reserved.
># /etc/init.d/jigsaw.server
># /etc/rc3.d/S10jigsaw.server (hard link to /etc/init.d/jigsaw.server)
># /etc/rc0.d/K39jigsaw.server (hard link to /etc/init.d/jigsaw.server)
>#
>#pragma ident	"@(#)jigsaw.server	1.8	1999/05/29 IMI"
>#
>#######################################################
># version history
># V1.8 (26.07.1999): - fixed the longstandig (silly!) bug that "ps -ef |
grep bla-bla" returns the "grep" line
>#                    - "grep" replaced by "fgrep" - smaller, faster...
>#                    - reduced the "start" sleep value back to 5 sec...
># V1.7 (29.05.1999): - Changed CLASSPATH for JAVA Project-X Release 2
># V1.6 (12.05.1999): - stop now only starts jigkill if there's a
jigsaw-server process running
># V1.5 (07.05.1999): - start: increased the delay from 10 to 20 sec after
jigsaw has been invoked because 
>#                      some msgs are "eaten" by dtlogin/xdm
># V1.4 (03.05.1999): - added "save" option to save servers
>#                    - "stop" option now waits until the "jigkill"
background process returns
>#                    - fixed delay in stop option (was "sleep 8" instead
of "sleep 5"; 
>#                      bug introduced in V1.2)
>#                    - fixed startup delay (should be 10 sec to see
jigsaw's startup messages on console)
># V1.3 (28.04.1999): - changed CLASSPATH for new servlet archive
/usr/local/java/jsdk2.1/servlet.jar
>#                    - added SIGKILL shutdown method to force a "shutdown"
of jigsaw service if SIGTERM 
>#                      did not work
>#                    - added "restart_server" switch to make "stop" +
"start" in one step.
>#                      (I did not use the name "restart" because this may
be reserved by another /etc/init.d/ 
>#                      script functionality...)

># V1.2             : - added "sleep 5" at startup to see servers startup
messages before xdm/dtlogin hides 
>#                      this info...
># V1.1             : - initial release
>#######################################################
># Install instructions:
># copy this script to /etc/init.d/jigsaw.server and make hard links 
># /etc/rc3.d/S10jigsaw.server and /etc/rc0.d/K39jigsaw.server to this script
># Set permissions to 700 (chmod 700 /etc/init.d/jigsaw.server), otherwise
># the admin server's password is visible to anyone !!
>#######################################################
># User "modifyable" variables:
>JIGHOME=/home/jigsaw
>JIGHOST=gyros.informatik.med.uni-giessen.de
>JIGUID=jigsaw
>JIGGID=www
>
>JIGADMINUSER=admin
>JIGADMINPASSWD=pizza4all
>
># be carefull that this is in sync with the user classpath variables
>CLASSPATH=/usr/local/java/sax1.0/sax.jar:/usr/local/java/javasoft-project-x
/xml-tr2/xml.jar:/usr/local/java/ibmxml4j/xml4j_2_0_0/xml4j.jar:/usr/local/j
ava/jsdk2.1/servlet.jar:/usr/local/java/javamail-1.1.1/mail.jar:/usr/local/j
ava/jaf/activation.jar:/usr/java/lib/dt.jar:/usr/java/jre/lib/ext/iiimp.jar:
/usr/java/jre/lib/i18n.jar:/usr/java/jre/lib/rt.jar
>export CLASSPATH
>
>## do not edit below this line !!
>JIGBIN=${JIGHOME}/Jigsaw/Jigsaw/bin
>
># jigsaw installed on this system ?
>[ ! -d "${JIGHOME}" ] && exit
>
>
># asserts
>if [ ! -x ${JIGBIN}/jigsaw  ] ; then echo "${0}: no ${JIGBIN}/jigsaw"  ;
exit 0 ; fi
>if [ ! -x ${JIGBIN}/jigkill ] ; then echo "${0}: no ${JIGBIN}/jigkill" ;
exit 0 ; fi
>
>
># Start/stop processes required for jigsaw WWW server
>case "$1" in
>'start')
>    echo "jigsaw webserver\c"
>    
>    if [ -f /etc/jigsaw.pid ] ; then
>        echo " already running."
>        exit 0
>    else
>        # launch jigsaw web server
>        ${JIGBIN}/jigsaw -host ${JIGHOST} -root ${JIGHOME}/Jigsaw/Jigsaw
-user ${JIGUID} -group ${JIGGID} </dev/null >/dev/console 2>&1 &
>    
>        # store web-servers PID in /etc/jigsaw.pid
>        echo $! >/etc/jigsaw.pid
>      
>        echo " started." 
>
>        # give jigsaw a chance to print it's startup message to console
>        sleep 5
> 
>        exit 0
>    fi    
>    ;;
>
>'stop')   
>    if [ -f /etc/jigsaw.pid ] ; then
>        echo "Attempt to kill jigsaw web server\c"
>        
>        JIGPID=`cat /etc/jigsaw.pid`
>        
>        echo ".\c"
>        
>        # only and only start jigkill if there is a process that can killed !
>        if [ "`ps -ef -o pid | fgrep ${JIGPID} | fgrep -v fgrep`" != "" ]
; then
>            ${JIGBIN}/jigkill -u ${JIGADMINUSER} -p ${JIGADMINPASSWD}
--stop http://${JIGHOST}:8009/ >/dev/null &
>        
>            # time to wait for jigsaw to exit, after this fire a SIGTERM
to the JVM
>            TIMETOKILLJIG=48 # 4 min
>        
>            while [ "`ps -ef -o pid | fgrep ${JIGPID} | fgrep -v fgrep`"
!= "" ] ; do 
>                echo ".\c"
>                sleep 5
>                TIMETOKILLJIG=`expr ${TIMETOKILLJIG} - 1`
>            
>                # sometimes the JVM hangs; in this case (after
TIMETOKILLJIG * 5 sec) send a SIGTERM...
>                if [ ${TIMETOKILLJIG} -lt 1 ] ; then

>                  echo "(sending SIGTERM)\c"
>                  kill ${JIGPID}
>                fi
>            
>                # same as above, but the unfriendly KILL method to FORCE a
shutdown...
>                if [ ${TIMETOKILLJIG} -lt -5 ] ; then
>                    echo "(sending SIGKILL)\c"
>                    kill -9 ${JIGPID}
>                    echo "######## jigsaw server was KILLED !!!"
>                fi        
>            done 
>        fi
>        
>        # remove pid key
>        rm /etc/jigsaw.pid
>        
>        echo " done\c"
>        
>        # wait for "jigkill" background process
>        wait      
>        
>        echo "." 
>    else
>        echo "jigsaw web server not running."
>    fi
>    ;;
>    
>'restart_server')
>    echo "jigsaw restart:"
>    
>      echo "stopping jigsaw..."
>      ${0} stop
>      
>      sleep 2
>      
>      echo "starting jigsaw..."
>      ${0} start
>      
>    echo "restart done."
>    ;; 
>     
>'save')
>    if [ -f /etc/jigsaw.pid ] ; then
>        # any details are printed from jigkill...
>        ${JIGBIN}/jigkill -u ${JIGADMINUSER} -p ${JIGADMINPASSWD} --save
http://${JIGHOST}:8009/ 
>        
>        echo "save done."
>    else
>        echo "jigsaw web server not running."
>    fi
>    ;;
>    
>*)
>    echo "Usage: ${0} { start | stop | restart_server | save }"
>    exit 1
>    ;;
>esac
>exit 0
> 
************************************************************************
John E. Conlon
jconlon@verticon.com
tel: (770) 886-5470
fax: (770) 888-6894
<http://www.verticon.com/>www.verticon.com
************************************************************************

Received on Thursday, 12 August 1999 09:35:31 UTC