mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-28 01:06:17 +00:00
- Remove expired www/jakarta-tomcat4 port: www/jakarta-tomcat5 is recommended
instead for new installations
This commit is contained in:
parent
5a2c08a851
commit
0b6cb8e3ee
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=245395
1
MOVED
1
MOVED
@ -4215,3 +4215,4 @@ security/pear-Crypt_HMAC||2009-12-07|Please use security/pear-Crypt_HMAC2
|
||||
mail/dovecot-devel|mail/dovecot|2009-12-08|Non-devel version is newer
|
||||
net-mgmt/net-snmp-tkmib||2009-12-08|Depends on expired port p5-SNMP
|
||||
net-mgmt/p5-SNMP||2009-12-08|Expired
|
||||
www/jakarta-tomcat4||2009-12-08|Has expired: www/jakarta-tomcat5 is recommended instead for new installations
|
||||
|
@ -317,7 +317,6 @@
|
||||
SUBDIR += ismail
|
||||
SUBDIR += iwebcal
|
||||
SUBDIR += jakarta-jmeter
|
||||
SUBDIR += jakarta-tomcat4
|
||||
SUBDIR += jakarta-tomcat5
|
||||
SUBDIR += jawstats
|
||||
SUBDIR += jdresolve
|
||||
|
@ -1,141 +0,0 @@
|
||||
# New ports collection makefile for: jakarta-tomcat
|
||||
# Date created: 20 Oct 2000
|
||||
# Whom: des
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
PORTNAME= jakarta-tomcat
|
||||
PORTVERSION= 4.0.6
|
||||
PORTREVISION= 7
|
||||
CATEGORIES= www java
|
||||
MASTER_SITES= http://distfiles.coredump.cn/ \
|
||||
ftp://local-distfiles.freebsd.org.cn/pub/china-ports/liukang/
|
||||
|
||||
MAINTAINER= ports@FreeBSD.org
|
||||
COMMENT= Open-source Java web server by Apache, stable 4.0.x branch
|
||||
|
||||
DEPRECATED= www/jakarta-tomcat5 is recommended instead for new installations
|
||||
EXPIRATION_DATE=2009-01-12
|
||||
|
||||
USE_JAVA= yes
|
||||
JAVA_VERSION= 1.2+
|
||||
NO_BUILD= YES
|
||||
LATEST_LINK= ${APP_SHORTNAME}
|
||||
|
||||
USE_RC_SUBR= tomcat4.sh
|
||||
SUB_FILES= pkg-install pkg-deinstall
|
||||
|
||||
MAJOR_VER= ${PORTVERSION:R:R}
|
||||
APP_HOME?= ${PREFIX}/${PKGBASE}${PORTVERSION:R}
|
||||
LOG_DIR= ${APP_HOME}/logs
|
||||
PLIST_SUB+= T=${APP_HOME:S/^${PREFIX}\///} WWWOWN=${TOMCAT_USER} WWWGRP=${TOMCAT_GROUP}
|
||||
APP_TITLE= Jakarta Tomcat
|
||||
APP_SHORTNAME= tomcat${MAJOR_VER}
|
||||
TOMCAT_USER?= www
|
||||
TOMCAT_GROUP?= www
|
||||
PW?= /usr/sbin/pw
|
||||
HTTP_PORT?= 8180
|
||||
SHUTDOWN_PORT?= 8005
|
||||
WARP_PORT?= 8008
|
||||
AJP_1_3_PORT?= 8009
|
||||
STDOUT_LOG= ${LOG_DIR}/stdout.log
|
||||
STDERR_LOG= ${LOG_DIR}/stderr.log
|
||||
PID_FILE= /var/run/${APP_SHORTNAME}.pid
|
||||
REPLACE_FILES= ${WRKSRC}/conf/server.xml
|
||||
REPLACE_LIST_TEMP= ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/}
|
||||
JAR_FILE= bin/bootstrap.jar
|
||||
WRKDIR?= ${WRKDIRPREFIX}${.CURDIR}/work
|
||||
WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION}
|
||||
CONF_EXT= sample
|
||||
PLIST_SUB+= CONF_EXT=${CONF_EXT}
|
||||
|
||||
SUB_LIST= AJP_1_3_PORT=${AJP_1_3_PORT} \
|
||||
APP_HOME=${APP_HOME} \
|
||||
APP_SHORTNAME=${APP_SHORTNAME} \
|
||||
APP_TITLE="${APP_TITLE}" \
|
||||
GROUP=${TOMCAT_GROUP} \
|
||||
HTTP_PORT=${HTTP_PORT} \
|
||||
JAR_FILE=${JAR_FILE} \
|
||||
JAVA_HOME=${JAVA_HOME} \
|
||||
PID_FILE=${PID_FILE} \
|
||||
SHUTDOWN_PORT=${SHUTDOWN_PORT} \
|
||||
STDERR_LOG=${STDERR_LOG} \
|
||||
STDOUT_LOG=${STDOUT_LOG} \
|
||||
TOMCAT_HOME=${APP_HOME} \
|
||||
TOMCAT_VERSION=${MAJOR_VER} \
|
||||
USER=${TOMCAT_USER} \
|
||||
WARP_PORT=${WARP_PORT}
|
||||
|
||||
.include <bsd.port.pre.mk>
|
||||
|
||||
pre-patch:
|
||||
@${ECHO_MSG} "Installation settings:"
|
||||
@${ECHO_MSG} " Destination directory: ${APP_HOME}"
|
||||
@${ECHO_MSG} " Location of JDK: ${JAVA_HOME}"
|
||||
@${ECHO_MSG} " Location of Java port: ${JAVA_PORT}"
|
||||
@${ECHO_MSG} " Running as (user/group): ${TOMCAT_USER}/${TOMCAT_GROUP}"
|
||||
@${ECHO_MSG} " HTTP port: ${HTTP_PORT}"
|
||||
@${ECHO_MSG} " Shutdown listener port: ${SHUTDOWN_PORT}"
|
||||
@${ECHO_MSG} " WARP port: ${WARP_PORT}"
|
||||
@${ECHO_MSG} " AJP 1.3 connector port: ${AJP_1_3_PORT}"
|
||||
@${ECHO_MSG} " Logfile stdout: ${STDOUT_LOG}"
|
||||
@${ECHO_MSG} " Logfile stderr: ${STDERR_LOG}"
|
||||
|
||||
post-patch:
|
||||
@${ECHO_MSG} -n ">> Removing unneeded files..."
|
||||
@${RM} -f `${FIND} ${WRKSRC} -name '*.bat'` `${FIND} ${WRKSRC} -name '*.orig'` `${FIND} ${WRKSRC} -name '*.exe'`
|
||||
@${ECHO_MSG} " [ DONE ]"
|
||||
|
||||
.for file in ${REPLACE_FILES}
|
||||
@${ECHO_MSG} -n ">> Customizing `basename ${file}`..."
|
||||
@${SED} ${REPLACE_LIST_TEMP} ${file} > ${WRKDIR}/`basename ${file}`
|
||||
@${ECHO_MSG} " [ DONE ]"
|
||||
.endfor
|
||||
|
||||
pre-install:
|
||||
@PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
|
||||
|
||||
do-install:
|
||||
@${ECHO_MSG} -n ">> Creating destination directory..."
|
||||
@${MKDIR} ${APP_HOME}
|
||||
@${MKDIR} ${LOG_DIR}
|
||||
@${ECHO_MSG} " [ DONE ]"
|
||||
|
||||
@${ECHO_MSG} ">> Copying files to destination directory..."
|
||||
@${CP} ${WRKDIR}/server.xml ${WRKSRC}/conf/
|
||||
@(cd ${WRKSRC};${FIND} conf -type f | ${SED} -e '/${CONF_EXT}/d') \
|
||||
| while read a; do \
|
||||
${MV} ${WRKSRC}/$$a ${WRKSRC}/$$a.${CONF_EXT}; \
|
||||
if [ ! -e "${APP_HOME}/$$a" ]; then \
|
||||
${ECHO_MSG} " Installing local configuration file: ${APP_HOME}/$$a"; \
|
||||
${CP} ${WRKSRC}/$$a.${CONF_EXT} ${WRKSRC}/$$a; \
|
||||
else \
|
||||
${ECHO_MSG} " Preserving local configuration file: ${APP_HOME}/$$a"; \
|
||||
fi; \
|
||||
done
|
||||
@${CP} -R ${WRKSRC}/* ${APP_HOME}
|
||||
@${ECHO_MSG} " [ DONE ]"
|
||||
|
||||
@${ECHO_MSG} -n ">> Creating log files..."
|
||||
@${INSTALL} /dev/null ${STDOUT_LOG}
|
||||
@${INSTALL} /dev/null ${STDERR_LOG}
|
||||
@${ECHO_MSG} " [ DONE ]"
|
||||
|
||||
@${ECHO_MSG} -n ">> Creating symlink to tools.jar..."
|
||||
@${LN} -sf ${JAVA_HOME}/lib/tools.jar ${APP_HOME}/common/lib/tools.jar
|
||||
@${ECHO_MSG} " [ DONE ]"
|
||||
|
||||
@${ECHO_MSG} -n ">> Fixing ownership settings..."
|
||||
@${CHOWN} -R ${TOMCAT_USER}:${TOMCAT_GROUP} ${APP_HOME}/conf ${APP_HOME}/logs \
|
||||
${APP_HOME}/temp ${APP_HOME}/work
|
||||
@${ECHO_MSG} " [ DONE ]"
|
||||
|
||||
@${ECHO_MSG} -n ">> Fixing permissions..."
|
||||
@${CHMOD} 755 `${FIND} ${APP_HOME} -type d`
|
||||
@${ECHO_MSG} " [ DONE ]"
|
||||
|
||||
post-install:
|
||||
@${ECHO_MSG} "${APP_TITLE} ${PORTVERSION} has been installed in ${APP_HOME}."
|
||||
|
||||
.include <bsd.port.post.mk>
|
@ -1,3 +0,0 @@
|
||||
MD5 (jakarta-tomcat-4.0.6.tar.gz) = 643f334059afa719a3d0bc1b04ac7504
|
||||
SHA256 (jakarta-tomcat-4.0.6.tar.gz) = 284e7b002ab6f976b9d6977eb8b6f9947ffffb7456ea2d6471c837b43fdc104f
|
||||
SIZE (jakarta-tomcat-4.0.6.tar.gz) = 4313503
|
@ -1,75 +0,0 @@
|
||||
.Dd February 21, 2002
|
||||
.Dt %%CONTROL_SCRIPT_MANPAGE_TITLE%% 1
|
||||
.Os FreeBSD
|
||||
.Sh NAME
|
||||
.Nm %%CONTROL_SCRIPT_NAME%%
|
||||
.Nd %%APP_TITLE%% server control interface
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Ar start | Ar restart | Ar stop
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
program provides an interface to the %%APP_TITLE%% application server.
|
||||
.Pp
|
||||
The program expects exactly one argument, either
|
||||
.Ar start ,
|
||||
.Ar restart
|
||||
or
|
||||
.Ar stop .
|
||||
If more than one argument is given, then all arguments but the first are
|
||||
ignored.
|
||||
.Bl -tag -width indent
|
||||
.It Ar start
|
||||
Start %%APP_TITLE%%, if it is not already running.
|
||||
.It Ar restart
|
||||
Restart %%APP_TITLE%%. If it is already running, then it will be stopped and
|
||||
then started right after that. Otherwise it will just be started up.
|
||||
.It Ar stop
|
||||
Stop %%APP_TITLE%%, if it is actually running.
|
||||
.El
|
||||
.Sh ERRORS
|
||||
The following error conditions are detected. They will be checked in the
|
||||
specified order. In each case an error message is printed with the name of the
|
||||
control program prepended.
|
||||
.Pp
|
||||
If no argument is passed, then a simple help message is printed and the
|
||||
program exists with error code 0.
|
||||
.Pp
|
||||
If at least one argument is passed, but it is different from
|
||||
.Ar start ,
|
||||
.Ar restart
|
||||
or
|
||||
.Ar stop
|
||||
then the help message is printed as well, and the program exits with error
|
||||
code 1.
|
||||
.Pp
|
||||
The following errors conditions are defined:
|
||||
.Bl -tag -width indent
|
||||
.It Em Illegal program argument (error code 1)
|
||||
.It Em PID file not found (error code 2)
|
||||
.It Em PID file too large (error code 3)
|
||||
.It Em PID file contains illegal character (error code 4)
|
||||
.It Em Kill of process failed (error code 5)
|
||||
.It Em %%APP_TITLE%% is already running (error code 6)
|
||||
.It Em %%APP_TITLE%% is not running (error code 7)
|
||||
.It Em Unable to chdir to the %%APP_TITLE%% home directory (error code 8)
|
||||
.It Em Unable to open the stdout log file (error code 9)
|
||||
.It Em Unable to open the stderr log file (error code 10)
|
||||
.It Em Unable to start %%APP_TITLE%% (error code 11)
|
||||
.El
|
||||
.Sh FILES
|
||||
.Bl -tag -width -indent
|
||||
.It Pa %%PID_FILE%%
|
||||
The %%APP_TITLE%% PID file that is used to store the process ID of the
|
||||
currently running process in. It is emptied as soon as the server is stopped
|
||||
and filled with the process ID when it is started. It should never be writable
|
||||
for anyone but
|
||||
.Em www ,
|
||||
.It Pa %%STARTUP_SCRIPT%%
|
||||
A script that starts the
|
||||
.Nm
|
||||
program. It is used to start %%APP_TITLE%% at startup time.
|
||||
.El
|
||||
.Sh AUTHORS
|
||||
.An Ernst de Haan Aq znerd@FreeBSD.org
|
@ -1,484 +0,0 @@
|
||||
/*
|
||||
* -*- mode: Fundamental; tab-width: 4; -*-
|
||||
* ex:ts=4
|
||||
*
|
||||
* Daemon control program.
|
||||
*
|
||||
* $FreeBSD: /tmp/pcvs/ports/www/jakarta-tomcat4/files/Attic/daemonctl.c,v 1.10 2002-10-09 23:10:32 znerd Exp $
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/uio.h>
|
||||
|
||||
/* The maximum size of the PID file, in bytes */
|
||||
#define MAX_FILE_SIZE 32
|
||||
|
||||
/* The interval in seconds between the checks to make sure the process
|
||||
died after a kill */
|
||||
#define STOP_TIME_INTERVAL 1
|
||||
|
||||
#define ERR_ILLEGAL_ARGUMENT 1
|
||||
#define ERR_PID_FILE_NOT_FOUND 2
|
||||
#define ERR_PID_FILE_TOO_LARGE 3
|
||||
#define ERR_PID_FILE_CONTAINS_ILLEGAL_CHAR 4
|
||||
#define ERR_KILL_FAILED 5
|
||||
#define ERR_ALREADY_RUNNING 6
|
||||
#define ERR_NOT_RUNNING 7
|
||||
#define ERR_CHDIR_TO_APP_HOME 8
|
||||
#define ERR_ACCESS_JAR_FILE 17
|
||||
#define ERR_STDOUT_LOGFILE_OPEN 9
|
||||
#define ERR_STDERR_LOGFILE_OPEN 10
|
||||
#define ERR_FORK_FAILED 11
|
||||
#define ERR_STAT_JAVA_HOME 12
|
||||
#define ERR_JAVA_HOME_NOT_DIR 13
|
||||
#define ERR_STAT_JAVA_CMD 14
|
||||
#define ERR_JAVA_CMD_NOT_FILE 15
|
||||
#define ERR_JAVA_CMD_NOT_EXECUTABLE 16
|
||||
|
||||
#define private static
|
||||
|
||||
private void printUsage(void);
|
||||
private int openPIDFile(void);
|
||||
private int readPID(int);
|
||||
private void writePID(int file, int pid);
|
||||
private void start(void);
|
||||
private void stop(void);
|
||||
private void restart(void);
|
||||
|
||||
|
||||
/**
|
||||
* Main function. This function is called when this program is executed.
|
||||
*
|
||||
* @param argc
|
||||
* the number of arguments plus one, so always greater than 0.
|
||||
*
|
||||
* @param argv
|
||||
* the arguments in an array of character pointers, where the last argument
|
||||
* element is followed by a NULL element.
|
||||
*/
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
/* Declare variables, like all other good ANSI C programs do :) */
|
||||
char *argument;
|
||||
|
||||
/* Parse the arguments */
|
||||
if (argc < 2) {
|
||||
printUsage();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* XXX: Fix for setting up the environment for the java wrapper script */
|
||||
setuid(geteuid());
|
||||
setgid(getegid());
|
||||
|
||||
argument = argv[1];
|
||||
if (strcmp("start", argument) == 0) {
|
||||
start();
|
||||
} else if (strcmp("stop", argument) == 0) {
|
||||
stop();
|
||||
} else if (strcmp("restart", argument) == 0) {
|
||||
restart();
|
||||
} else {
|
||||
fprintf(stderr, "%%CONTROL_SCRIPT_NAME%%: Illegal argument \"%s\".\n", argument);
|
||||
printUsage();
|
||||
exit(ERR_ILLEGAL_ARGUMENT);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prints usage information to stdout.
|
||||
*/
|
||||
void printUsage(void) {
|
||||
printf("Usage: %%CONTROL_SCRIPT_NAME%% [ start | stop | restart ]\n");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Attempts to open the PID file. If that file is successfully opened, then
|
||||
* the file handle (an int) will be returned.
|
||||
*
|
||||
* @return
|
||||
* the file handle.
|
||||
*/
|
||||
int openPIDFile(void) {
|
||||
|
||||
int file;
|
||||
|
||||
/* Attempt to open the PID file */
|
||||
file = open("%%PID_FILE%%", O_RDWR);
|
||||
if (file < 0) {
|
||||
printf(" [ FAILED ]\n");
|
||||
fprintf(stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to open %%PID_FILE%% for reading and writing: ");
|
||||
perror(NULL);
|
||||
exit(ERR_PID_FILE_NOT_FOUND);
|
||||
}
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reads a PID from the specified file. The file is identified by a file
|
||||
* handle.
|
||||
*
|
||||
* @param file
|
||||
* the file handle.
|
||||
*
|
||||
* @return
|
||||
* the PID, or -1 if the file was empty.
|
||||
*/
|
||||
int readPID(int file) {
|
||||
|
||||
char *buffer;
|
||||
int hadNewline = 0;
|
||||
unsigned int count;
|
||||
unsigned int i;
|
||||
int pid;
|
||||
|
||||
/* Read the PID file contents */
|
||||
buffer = (char *) malloc((MAX_FILE_SIZE + 1) * sizeof(char));
|
||||
count = read(file, buffer, MAX_FILE_SIZE + 1);
|
||||
if (count > MAX_FILE_SIZE) {
|
||||
printf(" [ FAILED ]\n");
|
||||
fprintf(stderr, "%%CONTROL_SCRIPT_NAME%%: The file %%PID_FILE%% contains more than %d bytes.\n", MAX_FILE_SIZE);
|
||||
exit(ERR_PID_FILE_TOO_LARGE);
|
||||
}
|
||||
|
||||
/* Convert the bytes to a number */
|
||||
pid = 0;
|
||||
for (i=0; i<count; i++) {
|
||||
char c = buffer[i];
|
||||
if (c >= '0' && c <= '9') {
|
||||
char digit = c - '0';
|
||||
pid *= 10;
|
||||
pid += digit;
|
||||
} else if (i == (count - 1) && c == '\n') {
|
||||
/* XXX: Ignore a newline at the end of the file */
|
||||
hadNewline = 1;
|
||||
} else {
|
||||
printf(" [ FAILED ]\n");
|
||||
fprintf(stderr, "%%CONTROL_SCRIPT_NAME%%: The file %%PID_FILE%% contains an illegal character (%d) at position %d.\n", c, i);
|
||||
exit(ERR_PID_FILE_CONTAINS_ILLEGAL_CHAR);
|
||||
}
|
||||
}
|
||||
printf(" [ DONE ]\n");
|
||||
|
||||
if (count == 0 || (count == 1 && hadNewline == 1)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return pid;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Writes a process ID to the specified file. The file is identified by a file
|
||||
* handle.
|
||||
*
|
||||
* @param file
|
||||
* the file handle, always greater than 0.
|
||||
*
|
||||
* @param pid
|
||||
* the PID to store, always greater than 0.
|
||||
*/
|
||||
void writePID(int file, int pid) {
|
||||
|
||||
char *buffer;
|
||||
int nbytes;
|
||||
|
||||
/* Check preconditions */
|
||||
assert(file > 0);
|
||||
assert(pid > 0);
|
||||
|
||||
printf(">> Writing PID file...");
|
||||
|
||||
lseek(file, (off_t) 0, SEEK_SET);
|
||||
ftruncate(file, (off_t) 0);
|
||||
nbytes = asprintf(&buffer, "%d\n", pid);
|
||||
write(file, buffer, nbytes);
|
||||
printf(" [ DONE ]\n");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if the specified process is running.
|
||||
*
|
||||
* @param pid
|
||||
* the process id, greater than 0.
|
||||
*
|
||||
* @return
|
||||
* 0 if the specified process is not running, a different value otherwise.
|
||||
*/
|
||||
int existsProcess(int pid) {
|
||||
|
||||
int result;
|
||||
|
||||
/* Check preconditions */
|
||||
assert(pid > 0);
|
||||
|
||||
/* See if the process exists */
|
||||
result = kill(pid, 0);
|
||||
|
||||
/* If the result is 0, then the process exists */
|
||||
if (result == 0) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Kills the process identified by the specified ID.
|
||||
*
|
||||
* @param pid
|
||||
* the process id, greater than 0.
|
||||
*/
|
||||
void killProcess(int pid) {
|
||||
|
||||
int result;
|
||||
unsigned int waited;
|
||||
unsigned int forced;
|
||||
unsigned int interval = STOP_TIME_INTERVAL;
|
||||
unsigned int timeout = %%STOP_TIMEOUT%%;
|
||||
|
||||
/* Check preconditions */
|
||||
assert(pid > 0);
|
||||
|
||||
printf(">> Terminating process %d...", pid);
|
||||
result = kill(pid, SIGTERM);
|
||||
if (result < 0) {
|
||||
printf(" [ FAILED ]\n");
|
||||
fprintf(stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to kill process %d: ", pid);
|
||||
perror(NULL);
|
||||
exit(ERR_KILL_FAILED);
|
||||
}
|
||||
|
||||
/* Wait until the process is actually killed */
|
||||
result = existsProcess(pid);
|
||||
for (waited=0; result == 1 && waited < timeout; waited += interval)
|
||||
{
|
||||
printf(".");
|
||||
fflush(NULL);
|
||||
sleep(interval);
|
||||
result = existsProcess(pid);
|
||||
}
|
||||
|
||||
/* If the process still exists, then have no mercy and kill it */
|
||||
forced = 0;
|
||||
if (result == 1) {
|
||||
|
||||
/* Force the process to die */
|
||||
result = kill(pid, SIGKILL);
|
||||
if (result == 0) {
|
||||
forced = 1;
|
||||
printf(" [ DONE ]\n");
|
||||
fprintf(stderr, "%%CONTROL_SCRIPT_NAME%%: Process %d did not terminate within %%STOP_TIMEOUT%% sec. Killed.\n", pid);
|
||||
} else if (result != ESRCH) {
|
||||
printf(" [ FAILED ]\n");
|
||||
fprintf(stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to kill process %d: ", pid);
|
||||
perror(NULL);
|
||||
exit(ERR_KILL_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
if (forced == 0) {
|
||||
printf(" [ DONE ]\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Starts the daemon.
|
||||
*/
|
||||
void start(void) {
|
||||
|
||||
int file;
|
||||
int pid;
|
||||
int result;
|
||||
int stdoutLogFile;
|
||||
int stderrLogFile;
|
||||
struct stat sb;
|
||||
|
||||
/* Open and read the PID file */
|
||||
printf(">> Reading PID file (%%PID_FILE%%)...");
|
||||
file = openPIDFile();
|
||||
pid = readPID(file);
|
||||
|
||||
printf(">> Starting %%APP_TITLE%% %%PORTVERSION%%...");
|
||||
if (pid != -1) {
|
||||
|
||||
/* Check if the process actually exists */
|
||||
result = existsProcess(pid);
|
||||
if (result == 1) {
|
||||
printf(" [ FAILED ]\n");
|
||||
fprintf(stderr, "%%CONTROL_SCRIPT_NAME%%: %%APP_TITLE%% %%PORTVERSION%% is already running, PID is %d.\n", pid);
|
||||
exit(ERR_ALREADY_RUNNING);
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if the JDK home directory is actually a directory */
|
||||
result = stat("%%JAVA_HOME%%", &sb);
|
||||
if (result != 0) {
|
||||
printf(" [ FAILED ]\n");
|
||||
fprintf(stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to stat %%JAVA_HOME%%: ");
|
||||
perror(NULL);
|
||||
exit(ERR_STAT_JAVA_HOME);
|
||||
}
|
||||
if (!S_ISDIR(sb.st_mode)) {
|
||||
printf(" [ FAILED ]\n");
|
||||
fprintf(stderr, "%%CONTROL_SCRIPT_NAME%%: Java home directory %%JAVA_HOME%% is not a directory.\n");
|
||||
exit(ERR_JAVA_HOME_NOT_DIR);
|
||||
}
|
||||
|
||||
/* Check if the Java command is actually an executable regular file */
|
||||
result = stat("%%JAVA_HOME%%/%%JAVA_CMD%%", &sb);
|
||||
if (result != 0) {
|
||||
printf(" [ FAILED ]\n");
|
||||
fprintf(stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to stat %%JAVA_HOME%%/%%JAVA_CMD%%: ");
|
||||
perror(NULL);
|
||||
exit(ERR_STAT_JAVA_CMD);
|
||||
}
|
||||
if (!S_ISREG(sb.st_mode)) {
|
||||
printf(" [ FAILED ]\n");
|
||||
fprintf(stderr, "%%CONTROL_SCRIPT_NAME%%: Java command %%JAVA_HOME%%/%%JAVA_CMD%% is not a regular file.\n");
|
||||
exit(ERR_JAVA_CMD_NOT_FILE);
|
||||
}
|
||||
result = access("%%JAVA_HOME%%/%%JAVA_CMD%%", X_OK);
|
||||
if (result != 0) {
|
||||
printf(" [ FAILED ]\n");
|
||||
fprintf(stderr, "%%CONTROL_SCRIPT_NAME%%: Java command %%JAVA_HOME%%/%%JAVA_CMD%% is not executable: ");
|
||||
perror(NULL);
|
||||
exit(ERR_JAVA_CMD_NOT_EXECUTABLE);
|
||||
}
|
||||
|
||||
/* Change directory */
|
||||
result = chdir("%%APP_HOME%%");
|
||||
if (result < 0) {
|
||||
printf(" [ FAILED ]\n");
|
||||
fprintf(stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to access directory %%APP_HOME%%: ");
|
||||
perror(NULL);
|
||||
exit(ERR_CHDIR_TO_APP_HOME);
|
||||
}
|
||||
|
||||
/* See if the JAR file exists */
|
||||
result = access("%%APP_HOME%%/%%JAR_FILE%%", R_OK);
|
||||
if (result < 0) {
|
||||
printf(" [ FAILED ]\n");
|
||||
fprintf(stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to access JAR file %%APP_HOME%%/%%JAR_FILE%%: ");
|
||||
perror(NULL);
|
||||
exit(ERR_ACCESS_JAR_FILE);
|
||||
}
|
||||
|
||||
/* Open the stdout log file */
|
||||
stdoutLogFile = open("%%STDOUT_LOG%%", O_WRONLY);
|
||||
if (stdoutLogFile < 0) {
|
||||
printf(" [ FAILED ]\n");
|
||||
fprintf(stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to open %%STDOUT_LOG%% for writing: ");
|
||||
perror(NULL);
|
||||
exit(ERR_STDOUT_LOGFILE_OPEN);
|
||||
}
|
||||
lseek(stdoutLogFile, (off_t) 0, SEEK_END);
|
||||
|
||||
/* Open the stderr log file */
|
||||
stderrLogFile = open("%%STDERR_LOG%%", O_WRONLY);
|
||||
if (stderrLogFile < 0) {
|
||||
printf(" [ FAILED ]\n");
|
||||
fprintf(stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to open %%STDERR_LOG%% for writing: ");
|
||||
perror(NULL);
|
||||
exit(ERR_STDERR_LOGFILE_OPEN);
|
||||
}
|
||||
lseek(stderrLogFile, (off_t) 0, SEEK_END);
|
||||
|
||||
/* Split this process in two */
|
||||
pid = fork();
|
||||
if (pid == -1) {
|
||||
printf(" [ FAILED ]\n");
|
||||
fprintf(stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to fork: ");
|
||||
perror(NULL);
|
||||
exit(ERR_FORK_FAILED);
|
||||
}
|
||||
|
||||
if (pid == 0) {
|
||||
|
||||
/* Redirect stdout to log file */
|
||||
dup2(stdoutLogFile, STDOUT_FILENO);
|
||||
|
||||
/* Redirect stderr to log file */
|
||||
dup2(stderrLogFile, STDERR_FILENO);
|
||||
|
||||
/* TODO: Support redirection of both stdout and stderr to the same
|
||||
file using pipe(2) */
|
||||
|
||||
/* Execute the command */
|
||||
execl("%%JAVA_HOME%%/%%JAVA_CMD%%", "%%JAVA_HOME%%/%%JAVA_CMD%%", "-jar", %%JAVA_ARGS%% "%%JAR_FILE%%", %%JAR_ARGS%% NULL);
|
||||
|
||||
fprintf(stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to start %%APP_TITLE%% %%PORTVERSION%% since '%%JAVA_HOME%%/%%JAVA_CMD%% -jar %%JAR_FILE%%' in %%APP_HOME%%: ");
|
||||
perror(NULL);
|
||||
} else {
|
||||
printf(" [ DONE ]\n");
|
||||
writePID(file, pid);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops the daemon.
|
||||
*/
|
||||
void stop(void) {
|
||||
|
||||
int file;
|
||||
int pid;
|
||||
|
||||
/* Open and read the PID file */
|
||||
printf(">> Reading PID file (%%PID_FILE%%)...");
|
||||
file = openPIDFile();
|
||||
pid = readPID(file);
|
||||
|
||||
printf(">> Checking if %%APP_TITLE%% %%PORTVERSION%% is running...");
|
||||
|
||||
/* If there is a PID, see if the process still exists */
|
||||
if (pid != -1) {
|
||||
int result = kill(pid, 0);
|
||||
if (result != 0 && errno == ESRCH) {
|
||||
ftruncate(file, (off_t) 0);
|
||||
pid = -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* If there is no running process, produce an error */
|
||||
if (pid == -1) {
|
||||
printf(" [ FAILED ]\n");
|
||||
fprintf(stderr, "%%CONTROL_SCRIPT_NAME%%: %%APP_TITLE%% %%PORTVERSION%% is currently not running.\n");
|
||||
exit(ERR_NOT_RUNNING);
|
||||
}
|
||||
printf(" [ DONE ]\n");
|
||||
|
||||
/* Terminate the process */
|
||||
killProcess(pid);
|
||||
|
||||
/* Clear the PID file */
|
||||
ftruncate(file, (off_t) 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Restarts the process. If it not currently running, then it will fail.
|
||||
*/
|
||||
void restart(void) {
|
||||
stop();
|
||||
start();
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
$FreeBSD$
|
||||
|
||||
--- conf/server.xml.orig Sat Mar 30 18:58:31 2002
|
||||
+++ conf/server.xml Sat Mar 30 19:00:01 2002
|
||||
@@ -10,7 +10,7 @@
|
||||
define subcomponents such as "Valves" or "Loggers" at this level.
|
||||
-->
|
||||
|
||||
-<Server port="8005" shutdown="SHUTDOWN" debug="0">
|
||||
+<Server port="%%SHUTDOWN_PORT%%" shutdown="SHUTDOWN" debug="0">
|
||||
|
||||
|
||||
<!-- A "Service" is a collection of one or more "Connectors" that share
|
||||
@@ -51,9 +51,9 @@
|
||||
IP address of the remote client.
|
||||
-->
|
||||
|
||||
- <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
|
||||
+ <!-- Define a non-SSL HTTP/1.1 Connector -->
|
||||
<Connector className="org.apache.catalina.connector.http.HttpConnector"
|
||||
- port="8080" minProcessors="5" maxProcessors="75"
|
||||
+ port="%%HTTP_PORT%%" minProcessors="5" maxProcessors="75"
|
||||
enableLookups="true" redirectPort="8443"
|
||||
acceptCount="10" debug="0" connectionTimeout="60000"/>
|
||||
<!-- Note : To disable connection timeouts, set connectionTimeout value
|
||||
@@ -70,9 +70,9 @@
|
||||
</Connector>
|
||||
-->
|
||||
|
||||
- <!-- Define an AJP 1.3 Connector on port 8009 -->
|
||||
+ <!-- Define an AJP 1.3 Connector -->
|
||||
<Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
|
||||
- port="8009" minProcessors="5" maxProcessors="75"
|
||||
+ port="%%AJP_1_3_PORT%%" minProcessors="5" maxProcessors="75"
|
||||
acceptCount="10" debug="0"/>
|
||||
|
||||
<!-- Define a Proxied HTTP/1.1 Connector on port 8081 -->
|
||||
@@ -310,7 +310,7 @@
|
||||
<Service name="Tomcat-Apache">
|
||||
|
||||
<Connector className="org.apache.catalina.connector.warp.WarpConnector"
|
||||
- port="8008" minProcessors="5" maxProcessors="75"
|
||||
+ port="%%WARP_PORT%%" minProcessors="5" maxProcessors="75"
|
||||
enableLookups="true" appBase="webapps"
|
||||
acceptCount="10" debug="0"/>
|
||||
|
@ -1,47 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# This script does the following.
|
||||
#
|
||||
# * Checks if the PID file exists. If it does, it kills the
|
||||
# process and removes the PID file.
|
||||
#
|
||||
# * Checks if the '%%USER%%' user exists. If it does, then it displays
|
||||
# a message.
|
||||
#
|
||||
# $FreeBSD: /tmp/pcvs/ports/www/jakarta-tomcat4/files/Attic/pkg-deinstall.in,v 1.1 2006-02-07 08:50:07 lawrance Exp $
|
||||
#
|
||||
|
||||
USER=%%USER%%
|
||||
PID_FILE=%%PID_FILE%%
|
||||
|
||||
# Make sure we're in the right stage of the process
|
||||
if [ "$2" = "DEINSTALL" ]; then
|
||||
|
||||
# Kill the process if it is still running
|
||||
if [ -s ${PID_FILE} ]; then
|
||||
PID=`cat ${PID_FILE}`
|
||||
echo -n ">> Killing Jakarta Tomcat 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 "${USER}" 2>/dev/null 1>&2; then
|
||||
echo "To delete the ${USER} user permanently, use 'pw userdel ${USER}'"
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
@ -1,46 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Checks if the '%%USER%%' user and group exist. If they don't, then
|
||||
# an attempt is made to create both.
|
||||
#
|
||||
# $FreeBSD: /tmp/pcvs/ports/www/jakarta-tomcat4/files/Attic/pkg-install.in,v 1.1 2006-02-07 08:50:07 lawrance Exp $
|
||||
#
|
||||
|
||||
# Make sure we're called during the 'make install' process
|
||||
if [ "$2" != "PRE-INSTALL" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Set some constants
|
||||
UID=80
|
||||
GID=${UID}
|
||||
USER=%%USER%%
|
||||
GROUP=%%GROUP%%
|
||||
|
||||
# See if the group already exists
|
||||
if ! pw groupshow "${GROUP}" 2>/dev/null 1>&2; then
|
||||
|
||||
# If not, try to create it
|
||||
if pw groupadd ${GROUP} -g ${GID}; then
|
||||
echo "Added group \"${GROUP}\"."
|
||||
else
|
||||
echo "Adding group \"${GROUP}\" failed..."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# See if the user already exists
|
||||
if ! pw usershow "${USER}" 2>/dev/null 1>&2; then
|
||||
|
||||
# If not, try to create it
|
||||
if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \
|
||||
-s "/sbin/nologin" -d "/nonexistent" \
|
||||
-c "World Wide Web Owner"; \
|
||||
then
|
||||
echo "Added user \"${USER}\"."
|
||||
else
|
||||
echo "Adding user \"${USER}\" failed..."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
exit 0
|
@ -1,34 +0,0 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: Fundamental; tab-width: 4; -*-
|
||||
# ex:ts=4
|
||||
#
|
||||
# %%APP_TITLE%% startup script.
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
|
||||
# Set some variables
|
||||
MYSELF=`basename $0`
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n ' '
|
||||
truncate -s 0 %%PID_FILE%%
|
||||
chown %%USER%%:%%GROUP%% %%PID_FILE%%
|
||||
chmod 600 %%PID_FILE%%
|
||||
su -f -m %%USER%% -c "exec %%CONTROL_SCRIPT%% start" >/dev/null && echo -n '%%APP_SHORTNAME%%'
|
||||
;;
|
||||
stop)
|
||||
echo -n ' '
|
||||
chown %%USER%%:%%GROUP%% %%PID_FILE%%
|
||||
chmod 600 %%PID_FILE%%
|
||||
su -f -m %%USER%% -c "exec %%CONTROL_SCRIPT%% stop" >/dev/null 2>&1 ; echo -n '%%APP_SHORTNAME%%'
|
||||
;;
|
||||
*)
|
||||
echo ""
|
||||
echo "Usage: ${MYSELF} { start | stop }"
|
||||
echo ""
|
||||
exit 64
|
||||
;;
|
||||
esac
|
@ -1,167 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
# PROVIDE: tomcat%%TOMCAT_VERSION%%
|
||||
# REQUIRE: NETWORKING SERVERS
|
||||
# BEFORE: DAEMON
|
||||
# KEYWORD: shutdown
|
||||
|
||||
#
|
||||
# Configuration settings for tomcat%%TOMCAT_VERSION%% in /etc/rc.conf:
|
||||
#
|
||||
# tomcat%%TOMCAT_VERSION%%_enable (bool):
|
||||
# Set to "NO" by default.
|
||||
# Set it to "YES" to enable tomcat%%TOMCAT_VERSION%%
|
||||
#
|
||||
# tomcat%%TOMCAT_VERSION%%_flags (str):
|
||||
# Set to "" by default.
|
||||
# Extra flags passed to start command
|
||||
#
|
||||
# tomcat%%TOMCAT_VERSION%%_catalina_home (str)
|
||||
# Set to "%%TOMCAT_HOME%%" by default.
|
||||
# Set the CATALINA_HOME variable for the Tomcat process
|
||||
#
|
||||
# tomcat%%TOMCAT_VERSION%%_catalina_base (str)
|
||||
# Set to "%%TOMCAT_HOME%%" by default.
|
||||
# Set the CATALINA_BASE variable for the Tomcat process
|
||||
#
|
||||
# tomcat%%TOMCAT_VERSION%%_catalina_tmpdir (str)
|
||||
# Set to "%%TOMCAT_HOME%%/temp" by default.
|
||||
# Set the CATALINA_TMPDIR variable for the Tomcat process
|
||||
#
|
||||
# tomcat%%TOMCAT_VERSION%%_stdout_log (str)
|
||||
# Set to "%%STDOUT_LOG%%" by default.
|
||||
# Set the location for the Tomcat process log (standard output)
|
||||
#
|
||||
# tomcat%%TOMCAT_VERSION%%_stderr_log (str)
|
||||
# Set to "%%STDERR_LOG%%" by default.
|
||||
# Set the location for the Tomcat process log (error output)
|
||||
#
|
||||
# tomcat%%TOMCAT_VERSION%%_stop_timeout (num)
|
||||
# Set to "10" by default.
|
||||
# Sets the timeout in seconds to allow tomcat to shutdown.
|
||||
# After the timeout has elapsed, tomcat will be killed.
|
||||
#
|
||||
# tomcat%%TOMCAT_VERSION%%_java_home (str):
|
||||
# tomcat%%TOMCAT_VERSION%%_java_vendor (str):
|
||||
# tomcat%%TOMCAT_VERSION%%_java_version (str):
|
||||
# tomcat%%TOMCAT_VERSION%%_java_os (str):
|
||||
# Specify the requirements of the Java VM to use. See javavm(1).
|
||||
#
|
||||
# tomcat%%TOMCAT_VERSION%%_classpath (str):
|
||||
# Set to "" by default.
|
||||
# Addtional classes to add to the CLASSPATH
|
||||
#
|
||||
# tomcat%%TOMCAT_VERSION%%_java_opts (str):
|
||||
# Set to "" by default.
|
||||
# Java VM args to use.
|
||||
#
|
||||
|
||||
tomcat%%TOMCAT_VERSION%%_enable="${tomcat%%TOMCAT_VERSION%%_enable:-"NO"}"
|
||||
tomcat%%TOMCAT_VERSION%%_java_version="${tomcat%%TOMCAT_VERSION%%_java_version:-"%%JAVA_VERSION%%"}"
|
||||
tomcat%%TOMCAT_VERSION%%_user="${tomcat%%TOMCAT_VERSION%%_user:-"%%USER%%"}"
|
||||
tomcat%%TOMCAT_VERSION%%_catalina_home="${tomcat%%TOMCAT_VERSION%%_catalina_home:-"%%TOMCAT_HOME%%"}"
|
||||
tomcat%%TOMCAT_VERSION%%_catalina_base="${tomcat%%TOMCAT_VERSION%%_catalina_base:-"%%TOMCAT_HOME%%"}"
|
||||
tomcat%%TOMCAT_VERSION%%_catalina_tmpdir="${tomcat%%TOMCAT_VERSION%%_catalina_tmpdir:-"%%TOMCAT_HOME%%/temp"}"
|
||||
tomcat%%TOMCAT_VERSION%%_stdout_log="${tomcat%%TOMCAT_VERSION%%_stdout_log:-"%%STDOUT_LOG%%"}"
|
||||
tomcat%%TOMCAT_VERSION%%_stderr_log="${tomcat%%TOMCAT_VERSION%%_stderr_log:-"%%STDERR_LOG%%"}"
|
||||
tomcat%%TOMCAT_VERSION%%_stop_timeout="${tomcat%%TOMCAT_VERSION%%_stop_timeout:-"10"}"
|
||||
|
||||
. %%RC_SUBR%%
|
||||
|
||||
name="tomcat%%TOMCAT_VERSION%%"
|
||||
rcvar=`set_rcvar`
|
||||
pidfile="%%PID_FILE%%"
|
||||
|
||||
load_rc_config "${name}"
|
||||
|
||||
if [ -n "${tomcat%%TOMCAT_VERSION%%_java_home}" ] ; then
|
||||
export JAVA_HOME="${tomcat%%TOMCAT_VERSION%%_java_home}"
|
||||
fi
|
||||
|
||||
if [ -n "${tomcat%%TOMCAT_VERSION%%_java_version}" ] ; then
|
||||
export JAVA_VERSION="${tomcat%%TOMCAT_VERSION%%_java_version}"
|
||||
fi
|
||||
|
||||
if [ -n "${tomcat%%TOMCAT_VERSION%%_java_vendor}" ] ; then
|
||||
export JAVA_VENDOR="${tomcat%%TOMCAT_VERSION%%_java_vendor}"
|
||||
fi
|
||||
|
||||
if [ -n "${tomcat%%TOMCAT_VERSION%%_java_os}" ] ; then
|
||||
export JAVA_OS="${tomcat%%TOMCAT_VERSION%%_java_os}"
|
||||
fi
|
||||
|
||||
java_command="%%LOCALBASE%%/bin/java \
|
||||
${tomcat%%TOMCAT_VERSION%%_java_opts} \
|
||||
-Djava.endorsed.dirs=$JAVA_ENDORSED_DIRS \
|
||||
-classpath %%TOMCAT_HOME%%/%%JAR_FILE%%:%%TOMCAT_HOME%%/bin/commons-logging-api.jar:${tomcat%%TOMCAT_VERSION%%_classpath} \
|
||||
-Dcatalina.base=${tomcat%%TOMCAT_VERSION%%_catalina_base} \
|
||||
-Dcatalina.home=${tomcat%%TOMCAT_VERSION%%_catalina_home} \
|
||||
-Djava.io.tmpdir=${tomcat%%TOMCAT_VERSION%%_catalina_tmpdir} \
|
||||
org.apache.catalina.startup.Bootstrap"
|
||||
|
||||
log_args=">> ${tomcat%%TOMCAT_VERSION%%_stdout_log} \
|
||||
2>> ${tomcat%%TOMCAT_VERSION%%_stderr_log} "
|
||||
|
||||
# Subvert the check_pid_file procname check.
|
||||
if [ -f $pidfile ]; then
|
||||
read rc_pid junk < $pidfile
|
||||
if [ ! -z "$rc_pid" ]; then
|
||||
procname=`ps -o ucomm= $rc_pid`
|
||||
fi
|
||||
fi
|
||||
|
||||
required_files="${tomcat%%TOMCAT_VERSION%%_catalina_home}/conf/server.xml"
|
||||
|
||||
command="/usr/sbin/daemon"
|
||||
flags="-p ${pidfile} ${java_command} start ${tomcat%%TOMCAT_VERSION%%_flags} ${log_args}"
|
||||
|
||||
start_precmd=pid_touch
|
||||
stop_cmd="tomcat%%TOMCAT_VERSION%%_stop"
|
||||
|
||||
pid_touch ()
|
||||
{
|
||||
touch $pidfile
|
||||
chown $tomcat%%TOMCAT_VERSION%%_user $pidfile
|
||||
}
|
||||
|
||||
tomcat%%TOMCAT_VERSION%%_stop() {
|
||||
rc_pid=$(check_pidfile $pidfile *$procname*)
|
||||
|
||||
if [ -z "$rc_pid" ]; then
|
||||
[ -n "$rc_fast" ] && return 0
|
||||
if [ -n "$pidfile" ]; then
|
||||
echo "${name} not running? (check $pidfile)."
|
||||
else
|
||||
echo "${name} not running?"
|
||||
fi
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "Stopping ${name}."
|
||||
${java_command} stop
|
||||
tomcat_wait_max_for_pid ${tomcat%%TOMCAT_VERSION%%_stop_timeout} ${rc_pid}
|
||||
kill -KILL ${rc_pid} 2> /dev/null && echo "Killed."
|
||||
echo -n > ${pidfile}
|
||||
}
|
||||
|
||||
tomcat_wait_max_for_pid() {
|
||||
_timeout=$1
|
||||
shift
|
||||
_pid=$1
|
||||
_prefix=
|
||||
while [ $_timeout -gt 0 ] ; do
|
||||
echo -n ${_prefix:-"Waiting (max $_timeout secs) for PIDS: "}$_pid
|
||||
_prefix=", "
|
||||
sleep 2
|
||||
kill -0 $_pid 2> /dev/null || break
|
||||
_timeout=$(($_timeout-2))
|
||||
done
|
||||
if [ -n "$_prefix" ]; then
|
||||
echo "."
|
||||
fi
|
||||
}
|
||||
|
||||
run_rc_command "$1"
|
@ -1,9 +0,0 @@
|
||||
Jakarta Tomcat is a web server written in 100% Pure Java. The
|
||||
Tomcat 4 branch is the reference implementation for the Java
|
||||
Servlet 2.3 and JavaServer Pages 1.2 technologies.
|
||||
|
||||
The Tomcat 4.0.x series are being replaced by the Tomcat 4.1.x
|
||||
series, which is a refactoring of 4.0 with some minor feature
|
||||
enhancements.
|
||||
|
||||
WWW: http://jakarta.apache.org/tomcat/
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user