Skip to main content
Question

Tomcat has to be restarted often

  • February 28, 2013
  • 27 replies
  • 149 views

Show first post

27 replies

Forum|alt.badge.img+5
  • New Contributor
  • October 31, 2013

@tkimpton][/url
Here's the plist for the Tomcat launch daemon:
[code]<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict> <key>Disabled</key> <false/> <key>Label</key> <string>com.jamfsoftware.tomcat</string> <key>OnDemand</key> <false/> <key>Program</key> <string>/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java</string> <key>ProgramArguments</key> <array> <string>/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java</string> <string>-Xms256m</string> <string>-Xmx5120m</string> <string>-XX:PermSize=64m</string> <string>-XX:MaxPermSize=128m</string> <string>-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager</string> <string>-Djava.util.logging.config.file=/Library/JSS/Tomcat/conf/logging.properties</string> <string>-Djava.awt.headless=true</string> <string>-Djava.endorsed.dirs=/Library/JSS/Tomcat/common/endorsed</string> <string>-classpath</string> <string>/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/lib/tools.jar:/Library/JSS/Tomcat/bin/bootstrap.jar:/Library/JSS/Tomcat/bin/tomcat-juli.jar</string> <string>-Dcatalina.base=/Library/JSS/Tomcat</string> <string>-Dcatalina.home=/Library/JSS/Tomcat</string> <string>-Djava.io.tmpdir=/Library/JSS/Tomcat/temp</string> <string>org.apache.catalina.startup.Bootstrap</string> <string>start</string> </array> <key>ServiceIPC</key> <false/> <key>UserName</key> <string>_appserver</string>
</dict>
</plist>[/code]

Monitor & restart JSS. It runs from launchd every 60 seconds. [code]#!/bin/bash
#
# Monitor JSS:9006 and restart if down. #

JSSURL="http://jss.company.com:9006"
restartlog="/Users/syadmin/Logs/JSS_restarted.log"

# Program runs once per monitoring interval
rc=/usr/bin/curl -s -I --max-time 2 $JSSURL | grep HTTP/1.1 | awk '{print $2}'

if [ "$rc" == "200" ]; then echo "date : $rc" > /tmp/JSS_Up if [ -f /tmp/JSS_Down ]; then `/bin/rm /tmp/JSS_Down` fi
elif [ ! -f /tmp/JSS_Down ]; then sleep 10 rc=/usr/bin/curl -s -I --max-time 2 $JSSURL | grep HTTP/1.1 | awk '{print $2}' if [ "$rc" == "200" ]; then echo "date : $rc" > /tmp/JSS_Up else echo "JSS down at: `/bin/date`" > /tmp/JSS_Down `/bin/launchctl unload /Library/LaunchDaemons/com.jamfsoftware.tomcat.plist` lastrestart=tail -1 /Users/sysadmin/Logs/JSS_restarted.log | awk '{print $3}' now=/bin/date +%s diffrestart=$((now-lastrestart)) if [ $diffrestart -lt 900 ]; then sleep 600 else sleep 10 fi `/bin/launchctl load /Library/LaunchDaemons/com.jamfsoftware.tomcat.plist` echo "JSS restarted `/bin/date +%s` `/bin/date`" >> $restartlog `/bin/date | /usr/bin/mailx -s "JSS restart" sysadmins@company.com` fi fi[/code]


Forum|alt.badge.img+12
  • Contributor
  • December 6, 2013

This is a real shot in the dark, but have you looked at your unmanaged clients recently? This may be a unique issue to our deployment, but I ran across about 800 clients that were previously managed and decided to flip themselves to unmanaged (this was probably a result of my JSS upgrade) I was maxing 500 database connections and crashing my JSS in about 20 minutes or so. I searched for unmanaged clients and retyped the management account name and password for the whole list and within 15 minutes or so my average database connections went from 500 to about 20 and my clients fell back into management. I am running Mac 10.8.5 with server app on a xserve, MySQL 5.5, and JSS 9.21. I called JAMF support to see if bad management account info will not allow the client to drop the database connection and am waiting for a response.