freebsd-ports/www/resin2/files/resin.sh.in
Greg Lewis 82fe3c91d5 . Update to 2.1.14.
PR:		68604
Submitted by:	Jean-Baptiste Quenot <jb.quenot@caraldi.com> (maintainer)
2004-07-02 22:10:15 +00:00

54 lines
1.2 KiB
Bash

#!/bin/sh
#
# Resin startup script.
#
# Borrowed from jakarta-tomcat41
#
# $FreeBSD$
#
# Determine PREFIX
if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/${0##*/}\$"); then
echo "$0: Cannot determine the PREFIX" >&2
exit 1
fi
# Set some variables
MYSELF=`basename $0`
ARGS="-conf $PREFIX/etc/%%APP_NAME%%.xml \
-chdir \
-name %%APP_NAME%% \
-class com.caucho.server.http.HttpServer \
-pid %%PID_FILE%%"
PATH=/usr/sbin:/usr/bin:/bin
unset CLASSPATH
export JAVA_HOME=%%JAVA_HOME%%
export RESIN_HOME=$PREFIX/%%APP_NAME%%
set -e
case "$1" in
start)
echo -n ' '
truncate -s 0 %%PID_FILE%%
chown %%RUNASUSER%%:%%GROUP%% %%PID_FILE%%
chmod 600 %%PID_FILE%%
su -f -m %%RUNASUSER%% -c "exec $PREFIX/sbin/%%APP_NAME%%ctl $ARGS start" \
>/dev/null && echo -n '%%APP_NAME%%'
;;
stop)
echo -n ' '
chown %%RUNASUSER%%:%%GROUP%% %%PID_FILE%%
chmod 600 %%PID_FILE%%
su -f -m %%RUNASUSER%% -c "exec $PREFIX/sbin/%%APP_NAME%%ctl $ARGS stop" \
>/dev/null 2>&1 ; echo -n '%%APP_NAME%%'
;;
*)
echo ""
echo "Usage: ${MYSELF} { start | stop }"
echo ""
exit 64
;;
esac