Posted on 02-13-2014 01:09 PM
We did update the JSS (RHEL 6.5) to 9.23 from 9.22.
Then as usual JDS no longer communicate. Then we updated the Master JDS with 9.23 installer and jamfds -v show 9.23 binary. But we cannot upload any package via CasperAdmin to the JSS. Annoying.
We had a similar issue when updating 9.2 to 9.22. But that worked later by updating the JDS'es to 9.22 too.
But that does not work with 9.23 now. What can we do ?
Posted on 02-14-2014 03:34 AM
Fixed.
There is an error in jamf.tomcat7 startup script in RHEL/CENTOS section
The temp folder is deleted at stop
but
at start it is not created. That part is missing in the script.
In Ubuntu section, the part is correct.
Posted on 02-22-2014 07:32 PM
Would you please post what the fixed RHEL start section should look like? I hit the same issue with the startup script when I upgraded my test RHEL VM to Casper 9.24.
Posted on 02-24-2014 07:52 AM
Just ran into this on OEL 6; I used the Linux installer and had the temp/pid file issue. Would love to see your fix.
(yes, I know OEL isn't RHEL, but the else branch of the tomcat init script would run in any case where the distro is not Ubuntu).
Posted on 03-03-2014 06:41 AM
Here the jamf.tomcat7 modified by our part to make it work in rhel 6.5
#!/bin/sh
#
# /etc/init.d/jamf.tomcat7 -- startup script for the JSS Tomcat 7 servlet engine
#
# Written for JSS Install by Brian Kelley Brian.Kelley@JAMFSoftware.com.
# 01/06/2014
# Originally from Ubuntu and CentOS
#
### BEGIN INIT INFO
# Provides: tomcat7
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Should-Start: $named
# Should-Stop: $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start Tomcat.
# Description: Start the Tomcat servlet engine.
### END INIT INFO
if [ `id -u` -ne 0 ]; then
echo "You need root privileges to run this script"
exit 1
fi
# Make sure tomcat is started with system locale
if [ -r /etc/default/locale ]; then
. /etc/default/locale
export LANG
fi
DISTRIB_ID=lsb_release -i -s 2>/dev/null
PATH=/bin:/usr/bin:/sbin:/usr/sbin
NAME=tomcat
DESC="Tomcat servlet engine"
JSS_HOME=/usr/local/jss
# Directory where the Tomcat 7 binary distribution resides
CATALINA_HOME=$JSS_HOME/$NAME
# Directory for per-instance configuration files and webapps
CATALINA_BASE=$JSS_HOME/$NAME
# Define other required variables
CATALINA_SH="$CATALINA_HOME/bin/catalina.sh"
CATALINA_PID="$JSS_HOME/$NAME/$NAME.pid"
# Use the Java security manager? (yes/no)
TOMCAT7_SECURITY=no
JVM_TMP=$JSS_HOME/$NAME/temp
# Run Tomcat 7 as this user ID and group ID
TOMCAT7_USER=tomcat7
TOMCAT7_GROUP=tomcat7
# The first existing directory is used for JAVA_HOME (if JAVA_HOME is not
# defined in $DEFAULT)
JDK_DIRS="/usr /usr/lib/jvm/java-7-openjdk-amd64 /usr/lib/jvm/java-6-openjdk /usr/lib/jvm/java-6-sun /usr/lib/jvm/java-1.5.0-sun /usr/lib/j2sdk1.5-sun /usr/lib/j2sdk1.5-ibm"
# Look for the right JVM to use
for jdir in $JDK_DIRS; do
if [ -r "$jdir/bin/java" -a -z "${JAVA_HOME}" ]; then
JAVA_HOME="$jdir"
fi
done
export JAVA_HOME
# Default Java options
# Set java.awt.headless=true if JAVA_OPTS is not set so the
# Xalan XSL transformer can work without X11 display on JDK 1.4+
# It also looks like the default heap size of 64M is not enough for most cases
# so the maximum heap size is set to 128M
if [ -z "$JAVA_OPTS" ]; then
JAVA_OPTS="-Djava.awt.headless=true"
fi
if [ -z "$CATALINA_TMPDIR" ]; then
CATALINA_TMPDIR="$JVM_TMP"
fi
# Look for Java Secure Sockets Extension (JSSE) JARs
if [ -z "${JSSE_HOME}" -a -r "${JAVA_HOME}/jre/lib/jsse.jar" ]; then
JSSE_HOME="${JAVA_HOME}/jre/"
fi
## Ubuntu specific startup utilizing the LSB functions ##
if [ "${DISTRIB_ID}" = "Ubuntu" ]; then
set -e
. /lib/lsb/init-functions
if [ -r /etc/default/rcS ]; then . /etc/default/rcS fi
# overwrite settings from default file if [ -f "$DEFAULT" ]; then . "$DEFAULT" fi
if [ ! -f "$CATALINA_HOME/bin/bootstrap.jar" ]; then log_failure_msg "$NAME is not installed" exit 1 fi
POLICY_CACHE="$CATALINA_BASE/work/catalina.policy"
# Set the JSP compiler if set in the tomcat7.default file if [ -n "$JSP_COMPILER" ]; then JAVA_OPTS="$JAVA_OPTS -Dbuild.compiler="$JSP_COMPILER"" fi
SECURITY="" if [ "$TOMCAT7_SECURITY" = "yes" ]; then SECURITY="-security" fi
catalina_sh() { # Escape any double quotes in the value of JAVA_OPTS JAVA_OPTS="$(echo $JAVA_OPTS | sed 's/"/\"/g')"
AUTHBIND_COMMAND="" if [ "$AUTHBIND" = "yes" -a "$1" = "start" ]; then JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true" AUTHBIND_COMMAND="/usr/bin/authbind --deep /bin/bash -c " fi
# Define the command to run Tomcat's catalina.sh as a daemon # set -a tells sh to export assigned variables to spawned shells. TOMCAT_SH="set -a; JAVA_HOME="$JAVA_HOME"; source "$DEFAULT"; CATALINA_HOME="$CATALINA_HOME"; CATALINA_BASE="$CATALINA_BASE"; JAVA_OPTS="$JAVA_OPTS"; CATALINA_PID="$CATALINA_PID"; CATALINA_TMPDIR="$CATALINA_TMPDIR"; LANG="$LANG"; JSSE_HOME="$JSSE_HOME"; cd "$CATALINA_BASE"; "$CATALINA_SH" $@"
if [ "$AUTHBIND" = "yes" -a "$1" = "start" ]; then TOMCAT_SH="'$TOMCAT_SH'" fi
# Run the catalina.sh script as a daemon set +e touch "$CATALINA_PID" "$CATALINA_BASE"/logs/catalina.out "$CATALINA_BASE"/logs/tomcatinit.log chown $TOMCAT7_USER "$CATALINA_PID" "$CATALINA_BASE"/logs/catalina.out "$CATALINA_BASE"/logs/tomcatinit.log start-stop-daemon --start -b -u "$TOMCAT7_USER" -g "$TOMCAT7_GROUP" -c "$TOMCAT7_USER" -d "$CATALINA_TMPDIR" -x /bin/bash -- -c "$AUTHBIND_COMMAND $TOMCAT_SH" /bin/bash "$CATALINA_BASE"/bin/version.sh >"$CATALINA_BASE"/logs/tomcatinit.log status="$?" set +a -e return $status }
case "$1" in start) if [ -z "$JAVA_HOME" ]; then log_failure_msg "no JDK found - please set JAVA_HOME" exit 1 fi
if [ ! -d "$CATALINA_BASE/conf" ]; then log_failure_msg "invalid CATALINA_BASE: $CATALINA_BASE" exit 1 fi
log_daemon_msg "Starting $DESC" "$NAME" if start-stop-daemon --test --start --pidfile "$CATALINA_PID" --user $TOMCAT7_USER --exec "$JAVA_HOME/bin/java" >/dev/null; then
# Regenerate POLICY_CACHE file umask 022 # echo "// AUTO-GENERATED FILE from /etc/tomcat7/policy.d/" # > "$POLICY_CACHE" echo "" >> "$POLICY_CACHE" # cat $CATALINA_BASE/conf/policy.d/*.policy # >> "$POLICY_CACHE"
# Remove / recreate JVM_TMP directory rm -rf "$JVM_TMP" mkdir -p "$JVM_TMP" || { log_failure_msg "could not create JVM temporary directory" exit 1 } chown $TOMCAT7_USER "$JVM_TMP"
catalina_sh start $SECURITY sleep 5 if start-stop-daemon --test --start --pidfile "$CATALINA_PID" --user $TOMCAT7_USER --exec "$JAVA_HOME/bin/java" >/dev/null; then if [ -f "$CATALINA_PID" ]; then rm -f "$CATALINA_PID" fi log_end_msg 1 else log_end_msg 0 fi else log_progress_msg "(already running)" log_end_msg 0 fi ;; stop) log_daemon_msg "Stopping $DESC" "$NAME"
set +e
if [ -f "$CATALINA_PID" ]; then
start-stop-daemon --stop --pidfile "$CATALINA_PID"
--user "$TOMCAT7_USER"
--retry=TERM/20/KILL/5 >/dev/null
if [ $? -eq 1 ]; then
log_progress_msg "$DESC is not running but pid file exists, cleaning up"
elif [ $? -eq 3 ]; then
PID="cat $CATALINA_PID
"
log_failure_msg "Failed to stop $NAME (pid $PID)"
exit 1
fi
rm -f "$CATALINA_PID"
rm -rf "$JVM_TMP"
else
log_progress_msg "(not running)"
fi
log_end_msg 0
set -e
;;
status)
set +e
start-stop-daemon --test --start --pidfile "$CATALINA_PID"
--user $TOMCAT7_USER --exec "$JAVA_HOME/bin/java"
>/dev/null 2>&1
if [ "$?" = "0" ]; then
if [ -f "$CATALINA_PID" ]; then log_success_msg "$DESC is not running, but pid file exists." exit 1 else log_success_msg "$DESC is not running." exit 3 fi else log_success_msg "$DESC is running with pid `cat $CATALINA_PID`" fi set -e ;; restart|force-reload) if [ -f "$CATALINA_PID" ]; then $0 stop sleep 1 fi $0 start ;; try-restart) if start-stop-daemon --test --start --pidfile "$CATALINA_PID" --user $TOMCAT7_USER --exec "$JAVA_HOME/bin/java" >/dev/null; then $0 start fi ;; *) log_success_msg "Usage: $0 {start|stop|restart|try-restart|force-reload|status}" exit 1 ;; esac exit 0
## CentOS/RHEL specific startup utilizing bash functions ##
else
# Start script for JSS Tomcat 7
# RHEL/CentOS Section
# chkconfig: 2345 84 15
# description: JSS Tomcat 7 start script
# processname: tomcat7
# pidfile: /var/run/tomcat.pid
. /etc/rc.d/init.d/functions
PS_HEADER=ps www -u ${TOMCAT7_USER} | grep PID
RETVAL=0
running() { ps www -u ${TOMCAT7_USER} | grep org.apache.catalina.startup.Bootstrap | grep -v grep }
case "$1" in start) if [ -f $CATALINA_PID ] ; then echo "${NAME} already running" exit 1 fi echo "Starting ${NAME}:" echo
set +e touch "$CATALINA_PID" "$CATALINA_BASE"/logs/catalina.out "$CATALINA_BASE"/logs/tomcatinit.log chown $TOMCAT7_USER "$CATALINA_PID" "$CATALINA_BASE"/logs/catalina.out "$CATALINA_BASE"/logs/tomcatinit.log
mkdir -p "$JVM_TMP" chown $TOMCAT7_USER:$TOMCAT7_USER "$JVM_TMP"
TOMCAT_SH="set -a; JAVA_HOME="$JAVA_HOME";
CATALINA_HOME="$CATALINA_HOME";
CATALINA_BASE="$CATALINA_BASE";
JAVA_OPTS="$JAVA_OPTS";
CATALINA_PID="$CATALINA_PID";
CATALINA_TMPDIR="$CATALINA_TMPDIR";
LANG="$LANG"; JSSE_HOME="$JSSE_HOME";
cd "$CATALINA_BASE";
"$CATALINA_SH" $@"
/bin/bash "$CATALINA_BASE"/bin/version.sh >"$CATALINA_BASE"/logs/tomcatinit.log
su ${TOMCAT7_USER} -c "$TOMCAT_SH"
sleep 5
;;
stop)
if [ -f "$CATALINA_PID" ]; then
PID=running | gawk '{print $1}'
echo "Shutting down ${NAME}: ${PID}"
su ${TOMCAT7_USER} -c "${CATALINA_HOME}/bin/catalina.sh stop" >/dev/null 2>&1
rm -f "$CATALINA_PID"
rm -rf "$JVM_TMP"
else
echo "${NAME} not running"
exit 1
fi
sleep 3
PID=running | gawk '{print $1}'
if [ -n "$PID" ] ; then
kill -9 $PID
fi
;;
restart)
$0 stop
sleep 5
$0 start
;;
kill)
PID=running | gawk '{print $1}'
if [ -n "$PID" ] ; then
echo "Killing ${NAME} process: "
echo $PID
kill -9 $PID
if [ -f $CATALINA_PID ] ; then
rm -f $CATALINA_PID
fi
else
echo "Tomcat is not running"
fi
;;
status)
if [ -f $CATALINA_PID ] ; then
echo "Process ${NAME} running with properties:"
echo
ps www -u ${TOMCAT7_USER}
else
echo "Process ${NAME} not running"
fi
;;
pid)
if [ -f $CATALINA_PID ] ; then
echo -n "Process ${NAME} running with number "
running | gawk '{print $1}'
else
echo "Process ${NAME} not running"
fi
;;
version)
echo "Checking version for ${NAME}:"
echo
su ${TOMCAT7_USER} -c "${CATALINA_HOME}/bin/catalina.sh version"
;;
*)
echo "Usage: $0 {start|stop|kill|restart|status|pid|version}"
echo "Command ${CATALINA_HOME}/bin/catalina.sh accepts additional parameters as well"
exit 1
esac
exit ${RETVAL}
fi
Posted on 03-03-2014 08:57 AM
Thanks for posting this; it looks like the addition is really just two lines in the non-Ubuntu start case:
mkdir -p "$JVM_TMP"
chown $TOMCAT7_USER:$TOMCAT7_USER "$JVM_TMP”
This didn't seem to solve it for me; I'm still getting the same symptom on my end (on shutdown, the tomcat PID file survives). I'm really not sure how, as doing a service restart on jamf.tomcat7 does seem to stop and start the service correctly (it's just the init 6 stop that's not working correctly it seems). As a work-around, I put the code from the "stop" case into the "start" case (without the ;;). Essentially, the effective bit seems to be removing the PID file if it exists on service start.
The question is why the PID file isn't getting deleted on service stop at shutdown, when running a service stop at any other time does delete the PID file.