SourceForge.net
2005-02-03 16:39:13 UTC
Bugs item #610282, was opened at 2002-09-17 00:12
Message generated for change (Settings changed) made by josevnz
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=474136&aid=610282&group_id=54559
Category: server
Group: v0.7.2b14
Priority: 5
Submitted By: José Vicente Núñez Zuleta (josevnz)
Assigned to: Nobody/Anonymous (nobody)
Summary: Start / stop script for Redhat: missing
Initial Comment:
Hi,
I started to use your product but i found there is not
script to start / stop it automatically for Redhat.
I wrote one myself, maybe will be usefull for someone
on the same situation as me.
Hope this helps,
PD: I tested this script on Redhat 7.2 but should work
on 7.0, 7.1, 7.2 and 7.3.
Jose Vicente Nunez Zuleta.
# <---- CUT HERE ------>
#!/bin/bash
# OpenJMS init file for JMS
#
# chkconfig: 35 50 50
# description: Open Source Implementation of the Sun
JMS API. # Written by exolab.org. http://openjms.sourceforge.net/
#
# Script author: Jose Vicente Nunez Zuleta
(***@yahoo.com) - 09/16/2002
#
# processname: /usr/local/openjms-0.7.2
# config: $OPENJMS_HOME/config
# pidfile: /var/run/openjms
# source function library
. /etc/rc.d/init.d/functions
# <!--- START OF USER CONFIGURABLE SECTION --->
# User configurable section. Please modify the value of
the following variables:
JAVA_HOME="/usr/java/j2sdk1.4.0_01"
OPENJMS_HOME="/usr/local/openjms-0.7.2"
CONFIG_FILE="rmi_jms_jdbc.xml"
# <!--- END OF USER CONFIGURABLE SECTION --->
OPTIONS_START="-config $OPENJMS_HOME/config/$CONFIG_FILE"
OPTIONS_STOP="-config $OPENJMS_HOME/config/$CONFIG_FILE
-stopServer"
RETVAL=0
prog="$OPENJMS_HOME/bin/startjms.sh"
admin="$OPENJMS_HOME/bin/admin.sh"
WAIT_TIME=10
force() {
rm -f /var/lock/subsys/openjms
start
}
start() {
echo -n "Starting $prog: "
res=0;
if [ ! -e /var/lock/subsys/openjms ] ; then
$prog $OPTIONS_START 2>&1 &
# Wait some time to give OpenJMS a chance to
start
sleep $WAIT_TIME
res=`/bin/ps $! | /usr/bin/wc -l`
else
echo
echo "A lock file for '$prog' was detected."
echo "Maybe another instance of this program
is running."
echo "If this is not true, then run it again
using '$0 force'."
fi
# Now check if is still there
[ $res -ne 0 ] && success || failure
RETVAL=$?
echo
touch /var/lock/subsys/openjms
return $RETVAL
}
stop() {
echo -n "Stopping $prog: "
#killproc $prog
res=`$admin $OPTIONS_STOP 2>&1 | /bin/grep
Exception | /usr/bin/wc -l`
if [ $res -eq 0 ] ; then
rm -f /var/lock/subsys/openjms
success
else
failure
fi
RETVAL=$?
echo
return $RETVAL
}
reload(){
stop
# Wait a little because the program takes at
least 5 seconds to die
sleep $WAIT_TIME
start
}
restart(){
reload
}
condrestart(){
[ -e /var/lock/subsys/openjms ] && restart
return 0
}
another_message() {
echo <<EOF
Another instance of OpenJMS is running."
If you think this is an error, type: '$0 force"
EOF
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
reload)
reload
;;
condrestart)
condrestart
;;
status)
status $prog
;;
force)
force
;;
*)
echo $"Usage: $0
{start|stop|status|restart|condrestart|reload|force}"
RETVAL=1
esac
exit $RETVAL
# <----- CUT HERE ----->
----------------------------------------------------------------------
Comment By: Tim Anderson (tanderson)
Date: 2003-01-13 03:57
Message:
Logged In: YES
user_id=557161
I've finally refactored the openjms scripts so they can be
more easily invoked by other user scripts.
If you can refactor your script using the 0.7.4 scripts I
will commit it.
In particular, take a look at the
$OPENJMS_HOME/bin/openjms.sh.
This can be used to start and stop OpenJMS - run it
without any arguments to get usage.
To duplicate the behaviour of your existing script:
. $OPENJMS_HOME/bin/openjms.sh run - to start
. $OPENJMS_HOME/bin/openjms.sh stop - to stop
Alternatively, invoke the wrapper scripts
$OPENJMS_HOME/bin/startup.sh and
$OPENJMS_HOME/bin/shutdown.sh
Note that the -config argument is no longer required. If
not set, $OPENJMS_HOME/config/openjms.xml will be
used.
BTW: It would be nice if the JAVA_HOME and
OPENJMS_HOME weren't hardcoded in the scripts. I
guess this could be got around by providing a simple
install script for Unix.
Regards,
Tim
----------------------------------------------------------------------
Comment By: José Vicente Núñez Zuleta (josevnz)
Date: 2002-09-17 00:19
Message:
Logged In: YES
user_id=283328
I tired to delete it, but i don't have permissions. The
fixed script is the last one, here is the code snipet i
added at the beginning:
# <!--- END OF USER CONFIGURABLE SECTION --->
[ -z $JAVA_HOME ] && exit 1
[ -z $OPENJMS_HOME ] && exit 1
[ ! -e $OPENJMS_HOME/config/$CONFIG_FILE ] && exit 1
----------------------------------------------------------------------
Comment By: José Vicente Núñez Zuleta (josevnz)
Date: 2002-09-17 00:18
Message:
Logged In: YES
user_id=283328
I added a little path to check for the environment variables
and the configuration file. I'm adding the new version and
deleting the old one.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=474136&aid=610282&group_id=54559
Message generated for change (Settings changed) made by josevnz
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=474136&aid=610282&group_id=54559
Category: server
Group: v0.7.2b14
Status: Closed
Resolution: NonePriority: 5
Submitted By: José Vicente Núñez Zuleta (josevnz)
Assigned to: Nobody/Anonymous (nobody)
Summary: Start / stop script for Redhat: missing
Initial Comment:
Hi,
I started to use your product but i found there is not
script to start / stop it automatically for Redhat.
I wrote one myself, maybe will be usefull for someone
on the same situation as me.
Hope this helps,
PD: I tested this script on Redhat 7.2 but should work
on 7.0, 7.1, 7.2 and 7.3.
Jose Vicente Nunez Zuleta.
# <---- CUT HERE ------>
#!/bin/bash
# OpenJMS init file for JMS
#
# chkconfig: 35 50 50
# description: Open Source Implementation of the Sun
JMS API. # Written by exolab.org. http://openjms.sourceforge.net/
#
# Script author: Jose Vicente Nunez Zuleta
(***@yahoo.com) - 09/16/2002
#
# processname: /usr/local/openjms-0.7.2
# config: $OPENJMS_HOME/config
# pidfile: /var/run/openjms
# source function library
. /etc/rc.d/init.d/functions
# <!--- START OF USER CONFIGURABLE SECTION --->
# User configurable section. Please modify the value of
the following variables:
JAVA_HOME="/usr/java/j2sdk1.4.0_01"
OPENJMS_HOME="/usr/local/openjms-0.7.2"
CONFIG_FILE="rmi_jms_jdbc.xml"
# <!--- END OF USER CONFIGURABLE SECTION --->
OPTIONS_START="-config $OPENJMS_HOME/config/$CONFIG_FILE"
OPTIONS_STOP="-config $OPENJMS_HOME/config/$CONFIG_FILE
-stopServer"
RETVAL=0
prog="$OPENJMS_HOME/bin/startjms.sh"
admin="$OPENJMS_HOME/bin/admin.sh"
WAIT_TIME=10
force() {
rm -f /var/lock/subsys/openjms
start
}
start() {
echo -n "Starting $prog: "
res=0;
if [ ! -e /var/lock/subsys/openjms ] ; then
$prog $OPTIONS_START 2>&1 &
# Wait some time to give OpenJMS a chance to
start
sleep $WAIT_TIME
res=`/bin/ps $! | /usr/bin/wc -l`
else
echo
echo "A lock file for '$prog' was detected."
echo "Maybe another instance of this program
is running."
echo "If this is not true, then run it again
using '$0 force'."
fi
# Now check if is still there
[ $res -ne 0 ] && success || failure
RETVAL=$?
echo
touch /var/lock/subsys/openjms
return $RETVAL
}
stop() {
echo -n "Stopping $prog: "
#killproc $prog
res=`$admin $OPTIONS_STOP 2>&1 | /bin/grep
Exception | /usr/bin/wc -l`
if [ $res -eq 0 ] ; then
rm -f /var/lock/subsys/openjms
success
else
failure
fi
RETVAL=$?
echo
return $RETVAL
}
reload(){
stop
# Wait a little because the program takes at
least 5 seconds to die
sleep $WAIT_TIME
start
}
restart(){
reload
}
condrestart(){
[ -e /var/lock/subsys/openjms ] && restart
return 0
}
another_message() {
echo <<EOF
Another instance of OpenJMS is running."
If you think this is an error, type: '$0 force"
EOF
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
reload)
reload
;;
condrestart)
condrestart
;;
status)
status $prog
;;
force)
force
;;
*)
echo $"Usage: $0
{start|stop|status|restart|condrestart|reload|force}"
RETVAL=1
esac
exit $RETVAL
# <----- CUT HERE ----->
----------------------------------------------------------------------
Comment By: Tim Anderson (tanderson)
Date: 2003-01-13 03:57
Message:
Logged In: YES
user_id=557161
I've finally refactored the openjms scripts so they can be
more easily invoked by other user scripts.
If you can refactor your script using the 0.7.4 scripts I
will commit it.
In particular, take a look at the
$OPENJMS_HOME/bin/openjms.sh.
This can be used to start and stop OpenJMS - run it
without any arguments to get usage.
To duplicate the behaviour of your existing script:
. $OPENJMS_HOME/bin/openjms.sh run - to start
. $OPENJMS_HOME/bin/openjms.sh stop - to stop
Alternatively, invoke the wrapper scripts
$OPENJMS_HOME/bin/startup.sh and
$OPENJMS_HOME/bin/shutdown.sh
Note that the -config argument is no longer required. If
not set, $OPENJMS_HOME/config/openjms.xml will be
used.
BTW: It would be nice if the JAVA_HOME and
OPENJMS_HOME weren't hardcoded in the scripts. I
guess this could be got around by providing a simple
install script for Unix.
Regards,
Tim
----------------------------------------------------------------------
Comment By: José Vicente Núñez Zuleta (josevnz)
Date: 2002-09-17 00:19
Message:
Logged In: YES
user_id=283328
I tired to delete it, but i don't have permissions. The
fixed script is the last one, here is the code snipet i
added at the beginning:
# <!--- END OF USER CONFIGURABLE SECTION --->
[ -z $JAVA_HOME ] && exit 1
[ -z $OPENJMS_HOME ] && exit 1
[ ! -e $OPENJMS_HOME/config/$CONFIG_FILE ] && exit 1
----------------------------------------------------------------------
Comment By: José Vicente Núñez Zuleta (josevnz)
Date: 2002-09-17 00:18
Message:
Logged In: YES
user_id=283328
I added a little path to check for the environment variables
and the configuration file. I'm adding the new version and
deleting the old one.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=474136&aid=610282&group_id=54559