Tag: macOS/Tomcat8
./startup.sh
./shutdown.sh
#!/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 LANG=ja_JP.UTF-8 export GITBUCKET_HOME=/opt/home/gitbucket export JAVA_HOME=$(/usr/libexec/java_home -v1.8) export CATALINA_HOME=/opt/home/tomcat export CATALINA_PID=$CATALINA_HOME/logs/tomcat.pid export JENKINS_HOME=/opt/home/jenkins $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>/opt/home/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>/opt/home/tomcat/logs/tomcat-launchd.stderr</string> <key>StandardOutPath</key> <string>/opt/home/tomcat/logs/tomcat-launchd.stdout</string> <key>UserName</key> <string>sora</string> </dict> </plist>
<user username="tomcat" password="xxxxx" roles="standard,manager-gui" />
sudo launchctl load -w /Library/LaunchDaemons/org.apache.tomcat.plist