Created
March 15, 2011 13:56
-
-
Save thesmith/870738 to your computer and use it in GitHub Desktop.
shell script to start jetty
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
cd `dirname "$0"` | |
USER=`whoami` | |
if [ $USER != 'jetty' ] | |
then | |
sudo -u jetty $0 $@ | |
exit $? | |
fi | |
case "$1" in | |
start) | |
if [ -f "./jetty.pid" ] | |
then | |
echo "Already running" | |
exit 1 | |
fi | |
nohup java -XX:MaxDirectMemorySize=1G -Xmx2G -Xms256m -DMBST_PLATFORM=prod -Dserver.port=8080 -jar leaf.jar > log & | |
echo $! > ./jetty.pid | |
;; | |
stop) | |
if [ -f "./jetty.pid" ]; | |
then | |
pid=`cat ./jetty.pid` | |
kill $pid | |
sleep 2 | |
ps -p $pid > /dev/null | |
if [ $? -eq 0 ]; | |
then | |
kill -9 $pid | |
fi | |
rm ./jetty.pid | |
else | |
echo "Process wasn't running" | |
fi | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment