|
|
8e2a7f |
#!/bin/sh
|
|
|
8e2a7f |
|
|
|
8e2a7f |
# This file was created with portions of the original SysV init script shipped
|
|
|
8e2a7f |
# with hsqldb
|
|
|
8e2a7f |
|
|
|
8e2a7f |
# Copyright (c) 2001-2004, The HSQL Development Group
|
|
|
8e2a7f |
# All rights reserved.
|
|
|
8e2a7f |
#
|
|
|
8e2a7f |
# Redistribution and use in source and binary forms, with or without
|
|
|
8e2a7f |
# modification, are permitted provided that the following conditions are met:
|
|
|
8e2a7f |
#
|
|
|
8e2a7f |
# Redistributions of source code must retain the above copyright notice, this
|
|
|
8e2a7f |
# list of conditions and the following disclaimer.
|
|
|
8e2a7f |
#
|
|
|
8e2a7f |
# Redistributions in binary form must reproduce the above copyright notice,
|
|
|
8e2a7f |
# this list of conditions and the following disclaimer in the documentation
|
|
|
8e2a7f |
# and/or other materials provided with the distribution.
|
|
|
8e2a7f |
#
|
|
|
8e2a7f |
# Neither the name of the HSQL Development Group nor the names of its
|
|
|
8e2a7f |
# contributors may be used to endorse or promote products derived from this
|
|
|
8e2a7f |
# software without specific prior written permission.
|
|
|
8e2a7f |
#
|
|
|
8e2a7f |
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
8e2a7f |
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
8e2a7f |
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
8e2a7f |
# ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG,
|
|
|
8e2a7f |
# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
|
8e2a7f |
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
|
8e2a7f |
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
8e2a7f |
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
|
8e2a7f |
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
8e2a7f |
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
8e2a7f |
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
8e2a7f |
|
|
|
8e2a7f |
# Class in the org.hsqldb package to start.
|
|
|
8e2a7f |
# At this time, only the values "Server" or "WebServer" will work.
|
|
|
8e2a7f |
TARGET_CLASS=Server
|
|
|
8e2a7f |
MAX_TERMINATE_SECS=1
|
|
|
8e2a7f |
|
|
|
8e2a7f |
# To customize settings, edit this file:
|
|
|
8e2a7f |
. /etc/sysconfig/hsqldb
|
|
|
8e2a7f |
|
|
|
8e2a7f |
# PROPERTY_FILE is a derived value.
|
|
|
8e2a7f |
case "$TARGET_CLASS" in
|
|
|
8e2a7f |
Server) PROPERTY_FILE="$SERVER_HOME"/server.properties;;
|
|
|
8e2a7f |
WebServer) PROPERTY_FILE="$SERVER_HOME"/webserver.properties;;
|
|
|
8e2a7f |
*)
|
|
|
8e2a7f |
echo 'Unsupported value for $TARGET_CLASS: '"$TARGET_CLASS" 1>&2
|
|
|
8e2a7f |
exit 6;;
|
|
|
8e2a7f |
esac
|
|
|
8e2a7f |
[ -f "$PROPERTY_FILE" ] || {
|
|
|
8e2a7f |
echo "'$PROPERTY_FILE' is missing" 1>&2
|
|
|
8e2a7f |
exit 6
|
|
|
8e2a7f |
}
|
|
|
8e2a7f |
[ -r "$PROPERTY_FILE" ] || {
|
|
|
8e2a7f |
echo "'$PROPERTY_FILE' isn't readable" 1>&2
|
|
|
8e2a7f |
exit 6
|
|
|
8e2a7f |
}
|
|
|
8e2a7f |
[ -r "$HSQLDB_JAR_PATH" ] || {
|
|
|
8e2a7f |
echo "'$HSQLDB_JAR_PATH' isn't readable" 1>&2
|
|
|
8e2a7f |
exit 6
|
|
|
8e2a7f |
}
|
|
|
8e2a7f |
[ -x "$JAVA_EXECUTABLE" ] || {
|
|
|
8e2a7f |
echo "No Java executable found at '$JAVA_EXECUTABLE'" 1>&2
|
|
|
8e2a7f |
exit 6
|
|
|
8e2a7f |
}
|
|
|
8e2a7f |
|
|
|
8e2a7f |
AUTH_FILE_SWITCH=
|
|
|
8e2a7f |
# N.b., there will be a problem if there are special characters or
|
|
|
8e2a7f |
# spaces inside of $AUTH_FILE.
|
|
|
8e2a7f |
[ -n "$AUTH_FILE" ] &&
|
|
|
8e2a7f |
AUTH_FILE_SWITCH="-Dsqltoolsprayer.rcfile=$AUTH_FILE"
|
|
|
8e2a7f |
# Might as well set CLASSPATH for a cleaner command.
|
|
|
8e2a7f |
CLASSPATH="$HSQLDB_JAR_PATH"
|
|
|
8e2a7f |
export CLASSPATH
|
|
|
8e2a7f |
export PATH # Required only for some funny init environments.
|
|
|
8e2a7f |
"$JAVA_EXECUTABLE" $AUTH_FILE_SWITCH $CLIENT_JVMARGS \
|
|
|
8e2a7f |
"-Dsqltoolsprayer.propfile=$PROPERTY_FILE" \
|
|
|
8e2a7f |
org.hsqldb.util.SqlToolSprayer "shutdown ;" \
|
|
|
8e2a7f |
$SHUTDOWN_URLIDS
|
|
|
8e2a7f |
sleep $MAX_TERMINATE_SECS # Give the JVM a sec. or 2 to fully exit.
|
|
|
8e2a7f |
echo "Successful shutdown ${SHUTDOWN_OPTION} (for the $TARGET_CLASS process)!"
|
|
|
8e2a7f |
exit 0
|
|
|
8e2a7f |
|