diff options
author | Ernst de Haan <znerd@FreeBSD.org> | 2002-03-07 19:47:15 +0000 |
---|---|---|
committer | Ernst de Haan <znerd@FreeBSD.org> | 2002-03-07 19:47:15 +0000 |
commit | 91b4ceeadb31ef3a9f4221f44473cc46af6fba43 (patch) | |
tree | 044ec2038e7b100acb3bd19b6a88a034511d4c66 /www/orion | |
parent | d664da4bf854ccf207fbfffa1dcc78eafe644041 (diff) | |
download | ports-91b4ceeadb31ef3a9f4221f44473cc46af6fba43.tar.gz ports-91b4ceeadb31ef3a9f4221f44473cc46af6fba43.zip |
Notes
Diffstat (limited to 'www/orion')
-rw-r--r-- | www/orion/Makefile | 21 | ||||
-rw-r--r-- | www/orion/files/orion.sh | 5 | ||||
-rw-r--r-- | www/orion/files/orionctl | 40 | ||||
-rw-r--r-- | www/orion/pkg-deinstall | 23 |
4 files changed, 62 insertions, 27 deletions
diff --git a/www/orion/Makefile b/www/orion/Makefile index 9261c743f3d5..df53553608ba 100644 --- a/www/orion/Makefile +++ b/www/orion/Makefile @@ -7,7 +7,7 @@ PORTNAME= orion PORTVERSION= 1.5.2 -PORTREVISION= 5 +PORTREVISION= 6 CATEGORIES= www java MASTER_SITES= http://www.orionserver.com/distributions/ \ http://www.atlassian.com/software/orion/downloads/ \ @@ -41,8 +41,8 @@ WITH_JIKES?= YES .if ${WITH_JIKES} == "YES" RUN_DEPENDS+= ${JIKES_LOCATION}:${PORTSDIR}/java/jikes .endif -USER_NAME= www -GROUP_NAME= www +USER= www +GROUP= www PW?= /usr/sbin/pw HTTP_PORT?= 8090 RMI_PORT?= 23791 @@ -59,7 +59,7 @@ pre-install: @${ECHO} " Location of JDK: ${JAVA_HOME}" @${ECHO} " Location of Java port: ${JAVA_PORT}" @${ECHO} " Using Jikes: ${WITH_JIKES}" - @${ECHO} " Running as (user/group): ${USER_NAME}/${GROUP_NAME}" + @${ECHO} " Running as (user/group): ${USER}/${GROUP}" @${ECHO} " HTTP port: ${HTTP_PORT}" @${ECHO} " RMI port: ${RMI_PORT}" @${ECHO} " Starting after install: ${AUTO_START}" @@ -102,8 +102,8 @@ do-install: | ${SED} "/%%LOG_DIR%%/s//${LOG_DIR:S/\//\\\//g}/" \ | ${SED} "/%%RC_SCRIPT_NAME%%/s//${PORTNAME}.sh/" \ | ${SED} "/%%JAVA_HOME%%/s//${JAVA_HOME:S/\//\\\//g}/" \ - | ${SED} "/%%USER_NAME%%/s//${USER_NAME}/" \ - | ${SED} "/%%GROUP_NAME%%/s//${GROUP_NAME}/" \ + | ${SED} "/%%USER%%/s//${USER}/" \ + | ${SED} "/%%GROUP%%/s//${GROUP}/" \ | ${SED} "/%%STDOUT_LOG%%/s//${STDOUT_LOG:S/\//\\\//g}/" \ | ${SED} "/%%STDERR_LOG%%/s//${STDERR_LOG:S/\//\\\//g}/" \ | ${SED} "/%%PID_FILE%%/s//${PID_FILE:S/\//\\\//g}/" \ @@ -112,7 +112,7 @@ do-install: @# Install the startup script ${CAT} ${FILESDIR}/${PORTNAME}.sh \ - | ${SED} "/%%USER_NAME%%/s//${USER_NAME}/" \ + | ${SED} "/%%USER%%/s//${USER}/" \ | ${SED} "/%%APP_SHORTNAME%%/s//${APP_SHORTNAME}/" \ | ${SED} "/%%CONTROL_SCRIPT%%/s//${CONTROL_SCRIPT:S/\//\\\//g}/" \ > ${STARTUP_SCRIPT} @@ -126,7 +126,12 @@ do-install: ${LN} -sf ${JAVA_HOME}/lib/tools.jar ${APP_HOME}/tools.jar @# Change ownership for the files - ${CHOWN} -R ${USER_NAME}:${GROUP_NAME} ${APP_HOME} + ${CHOWN} -R ${USER}:${GROUP} ${APP_HOME} + + @# Create the PID file + ${TOUCH} ${PID_FILE} + ${CHOWN} ${USER}:${GROUP} ${PID_FILE} + ${CHMOD} 0600 ${PID_FILE} @# Install the man page .if !defined(NOPORTDOCS) diff --git a/www/orion/files/orion.sh b/www/orion/files/orion.sh index cbd3e16f99b1..f76448b0b83e 100644 --- a/www/orion/files/orion.sh +++ b/www/orion/files/orion.sh @@ -1,15 +1,14 @@ #!/bin/sh # Set some variables -USER_NAME=%%USER_NAME%% MYSELF=`basename $0` case "$1" in start) - su -f -m ${USER_NAME} -c "exec %%CONTROL_SCRIPT%% start" && echo -n ' %%APP_SHORTNAME%%' + su -f -m %%USER%% -c "exec %%CONTROL_SCRIPT%% start" && echo -n ' %%APP_SHORTNAME%%' ;; stop) - su -f -m ${USER_NAME} -c "exec %%CONTROL_SCRIPT%% stop" && echo -n ' %%APP_SHORTNAME%%' + su -f -m %%USER%% -c "exec %%CONTROL_SCRIPT%% stop" && echo -n ' %%APP_SHORTNAME%%' ;; *) echo "" diff --git a/www/orion/files/orionctl b/www/orion/files/orionctl index eb1114d1cc0c..d6325382f82e 100644 --- a/www/orion/files/orionctl +++ b/www/orion/files/orionctl @@ -91,20 +91,27 @@ app() { start() { # Make sure the application is not started previously - if [ -e %%PID_FILE%% ]; then - error "Found %%APP_TITLE%% PID file at %%PID_FILE%%. It is probably already running." + if [ -s %%PID_FILE%% ]; then + error "%%APP_TITLE%% is probably already running. The PID file at %%PID_FILE%% is not empty." exit 1 fi # Perform the checks that apply to stopping as well checks - # Create the process ID file - rm -f %%PID_FILE%% - touch %%PID_FILE%% - chown %%USER_NAME%%:%%GROUP_NAME%% %%PID_FILE%% + # Fix the permissions for the PID file, just in case + chown %%USER%%:%%GROUP%% %%PID_FILE%% chmod 600 %%PID_FILE%% + + # Start the application + echo -n ">> Starting %%APP_TITLE%%..." (cd ${APP_HOME} && ${JAVA_CMD} -jar ${JAR_FILE} & echo $! > %%PID_FILE%%) >> ${STDOUT_LOG} 2>> ${STDERR_LOG} + if [ $? -eq 0 ]; then + echo " [ DONE ]" + else + echo " [ FAILED ]" + exit 13 + fi } @@ -120,12 +127,25 @@ stop() { checks # Kill the running program - if [ ! -e %%PID_FILE%% ]; then - error "Unable to find %%APP_TITLE%% PID file at %%PID_FILE%%. It is probably not running." + if [ ! -s %%PID_FILE%% ]; then + error "%%APP_TITLE%% is probably not running. The PID file at %%PID_FILE%% is empty." exit 16 fi - /bin/kill `cat %%PID_FILE%%` - rm -f %%PID_FILE%% + PID=`cat %%PID_FILE%%` + echo -n ">> Killing %%APP_TITLE%% process (${PID})..." + /bin/kill ${PID} > /dev/null 2> /dev/null + if [ $? -eq 0 ]; then + echo " [ DONE ]" + else + echo " [ FAILED ]" + fi + echo -n ">> Emptying PID file (%%PID_FILE%%)..." + > %%PID_FILE%% 2> /dev/null + if [ $? -eq 0 ]; then + echo " [ DONE ]" + else + echo " [ FAILED ]" + fi } diff --git a/www/orion/pkg-deinstall b/www/orion/pkg-deinstall index a5703cab3ad4..c45e6eb59f8d 100644 --- a/www/orion/pkg-deinstall +++ b/www/orion/pkg-deinstall @@ -13,17 +13,28 @@ # Make sure we're in the right stage of the process if [ "$2" = "DEINSTALL" ]; then + # Kill Orion if it is still running PID_FILE=/var/run/orion.pid - if [ -e ${PID_FILE} ]; then - echo -n "Orion Server is still running." - /bin/kill `cat ${PID_FILE}` - rm -f ${PID_FILE} - echo " Stopped." + if [ -s ${PID_FILE} ]; then + PID=`cat ${PID_FILE}` + echo -n ">> Killing Orion Server process (${PID})..." + /bin/kill ${PID} > /dev/null 2> /dev/null + if [ $? -eq 0 ]; then + echo " [ DONE ]" + else + echo " [ FAILED ]" + fi + echo -n ">> Removing PID file (${PID_FILE})..." + rm ${PID_FILE} > /dev/null 2> /dev/null + if [ $? -eq 0 ]; then + echo " [ DONE ]" + else + echo " [ FAILED ]" + fi fi fi - if [ "$2" = "POST-DEINSTALL" ]; then # If the user exists, then display a message if pw usershow "www" 2>/dev/null 1>&2; then |