Tag: Tomcat8
gzcat apache-tomcat-8.0.18.tar.gz | (cd /opt/home; tar xvpf - )
cd /opt/home ln -s apache-tomcat-8.0.18 tomcat
cd /opt/home/tomcat/bin ./startup.sh
※ただしJavaはJava8じゃないと起動しない。
#!/bin/sh # # Wrapper for running Tomcat under launchd # Required because launchd needs a non-daemonizing process function shutdown() { $CATALINA_HOME/bin/shutdown.sh /bin/rm $CATALINA_PID } function wait_for_death() { while /bin/kill -0 $1 2> /dev/null ; do sleep 2 done } export JAVA_HOME=$(/usr/libexec/java_home -v1.8) export CATALINA_HOME=/opt/home/tomcat export CATALINA_PID=$CATALINA_HOME/logs/tomcat.pid $CATALINA_HOME/bin/startup.sh trap shutdown QUIT ABRT KILL ALRM TERM TSTP sleep 2 wait_for_death `cat $CATALINA_PID`
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>org.apache.tomcat</string> <key>Disabled</key> <false/> <key>OnDemand</key> <false/> <key>RunAtLoad</key> <true/> <key>ProgramArguments</key> <array> <string>/Library/Tomcat/bin/tomcat-launchd.sh</string> </array> <key>EnvironmentVariables</key> <dict> <key>CATALINA_HOME</key> <string>/opt/home/tomcat</string> <key>JAVA_OPTS</key> <string>-Djava.awt.headless=true</string> </dict> <key>StandardErrorPath</key> <string>/Library/Tomcat/logs/tomcat-launchd.stderr</string> <key>StandardOutPath</key> <string>/Library/Tomcat/logs/tomcat-launchd.stdout</string> <key>UserName</key> <string>_appserver</string> </dict> </plist>
sudo launchctl load -w /Library/LaunchDaemons/org.apache.tomcat.plist