script de inicio
Victor Hugo dos Santos
listas.vhs en gmail.com
Mie Nov 7 16:44:39 CLST 2007
Senores,
tengo un problema con un script de inicio que modifique para arancar
una aplicacion... el script inicia correctamente cuando se prende la
maquina, pero no detiene la aplicacion al mandar apagar la
computadora.
mmmm.. comentarios ??
***************************
#!/bin/bash
#
# oc4j - shell for invoking OC4J basic operations.
#
# Usage: oc4j [Options]
#
# Options:
# -start : start OC4J
# -shutdown -port <ORMI port> -password <password>
# : stop OC4J
# -version : display the version
# -help : display this message
#
# Copyright (c) 2004, 2005, Oracle. All rights reserved.
#
# chkconfig: 2345 80 10
# description: Starts, stops and saves iptables firewall
. /etc/rc.d/init.d/functions
#########################################################
########## START CONFIGURATION SECTION ##################
#########################################################
ORACLE_HOME="/opt/oraclesa"
JAVA_HOME="/opt/oraclesa/java/default"
PATH=$PATH:$JAVA_HOME/bin
J2EE_HOME=$ORACLE_HOME/j2ee/home
#Any persistent arguments to specify at the JVM level can be set here
#By default this will be read from the operating system environment
if [ "$OC4J_JVM_ARGS" ]
then
JVMARGS=$OC4J_JVM_ARGS
else
JVMARGS=
fi
CMDARGS=
if [ "$VERBOSE" ]
then
VERBOSE=$VERBOSE
else
VERBOSE=off
fi
OC4J_JAR=$J2EE_HOME/oc4j.jar
ADMIN_JAR=$J2EE_HOME/admin.jar
SERVER_XML=$J2EE_HOME/config/server.xml
#########################################################
########## END CONFIGURATION SECTION ##################
#########################################################
check_oc4j()
{
EXIT=0
if [ "$JAVA_HOME" = "" ]
then
echo "Error: JAVA_HOME environment variable is not defined."
check_msg="correct JAVA_HOME environment variable."
EXIT=2
elif [ ! -x $JAVA_HOME/bin/java ]
then
echo "Error: Can not find java executable in $JAVA_HOME/bin."
check_msg="correct java executable."
EXIT=2
elif [ "$ORACLE_HOME" = "" ]
then
echo "Error: The ORACLE_HOME environment variable must be set
before executing this script. Set this to the directory into which you
unzipped oc4j_extended.zip."
check_msg="correct ORACLE_HOME environment variable."
EXIT=2
elif [ ! -r "$OC4J_JAR" ]
then
check_msg="readable $OC4J_JAR."
EXIT=2
elif [ ! -w "$SERVER_XML" ]
then
check_msg="writable $SERVER_XML."
EXIT=2
elif [ ! -r "$ADMIN_JAR" ]
then
check_msg="readable $ADMIN_JAR."
EXIT=2
fi
}
echo_check_msg()
{
echo "Error: The command can not be run without $1"
}
start()
{
echo "Starting OC4J from $J2EE_HOME ..."
CMDARGS="-config $SERVER_XML"
while [ $# -ge 1 ]
do
case $1 in
*)
echo ""
echo "Error: The optoin \"$1\" was not recognized."
EXIT=1
return
;;
esac
done
if [ "$VERBOSE" = "on" ]
then
echo "Executing: $JAVA_HOME/bin/java $JVMARGS -jar $OC4J_JAR $CMDARGS"
fi
daemon $JAVA_HOME/bin/java $JVMARGS -jar $OC4J_JAR $CMDARGS &
}
stop()
{
echo "Shutdown OC4J instance..."
killall java
}
version()
{
echo "Getting the version of OC4J instance..."
CMDARGS="-version"
if [ "$VERBOSE" = "on" ]
then
echo "Executing: $JAVA_HOME/bin/java $JVMARGS -jar $OC4J_JAR $CMDARGS"
fi
$JAVA_HOME/bin/java $JVMARGS -jar $OC4J_JAR $CMDARGS
}
help()
{
cat <<EOF
Usage: oc4j [Options]
Options:
start : start OC4J
stop : stop OC4J
version : display the version
help : display this message
EOF
}
########################################
### Start main function section ###
########################################
#check_oc4j
#if [ ! "$EXIT" -eq 0 ]
#then
# echo_check_msg "$check_msg"
#else
# if [ $# -eq 0 ]
# then
# help
# else
# the first argument
CMDARG="$1"
# decrement number of arguments
shift
# get the rest of the command line
case $CMDARG in
start)
start
;;
stop)
stop
;;
version)
if [ $# -gt 0 ] ; then
echo ""
echo "Error: The option \"$CMDARG\" does not take any argument."
EXIT=1
else
version
fi
;;
*)
help
EXIT=0
;;
esac
***************************
salu2
--
--
Victor Hugo dos Santos
Linux Counter #224399
Más información sobre la lista de distribución Linux