Skip to content

Instantly share code, notes, and snippets.

@robb1e
Created June 17, 2010 09:49
Show Gist options
  • Save robb1e/441916 to your computer and use it in GitHub Desktop.
Save robb1e/441916 to your computer and use it in GitHub Desktop.
NAME=projectname
PORT=port
ENVIRONMENT=staging
URI=$NAME.$ENVIRONMENT
DIRECTORY=/mnt/apps/$ENVIRONMENT/$NAME
case "$1" in
start)
lsof -i :$PORT
if [ $? -eq 0 ]; then
echo "The port "$PORT" is already in use"
else
echo -n "Starting daemon: "$NAME
nohup grails -Dserver.port=$PORT -Duri=$URI prod run-app &
echo "."
fi
;;
stop)
echo -n "Stopping daemon: "$NAME
ps -ef | grep $PORT | grep -v grep | awk '{print "kill " $2}' | sh
echo "."
;;
*)
echo "Usage: "$1" {start|stop}"
exit 1
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment