Skip to content

Instantly share code, notes, and snippets.

@mikeknep
Created November 11, 2015 01:14
Show Gist options
  • Save mikeknep/eb0468c61d7729fecffa to your computer and use it in GitHub Desktop.
Save mikeknep/eb0468c61d7729fecffa to your computer and use it in GitHub Desktop.
Compile and run steps for my Java HTTP server
# Dahomey
## My Java HTTP server
dahomey() {
if [ $# -eq 0 ]
then
cd ~/8thlight/dahomey/
elif [ $1 = "jar" ]
then
jar cfmv dahomey.jar ~/8thlight/dahomey/src/META-INF/MANIFEST.MF -C ~/8thlight/dahomey/out/production/dahomey/ .
elif [ $1 = "start" ]
then
java -jar dahomey.jar ${*:2}
elif [ $1 = "router" ]
then
jar cfmv router.jar ~/8thlight/basic_router/src/META-INF/MANIFEST.MF -C ~/8thlight/basic_router/out/production/basic_router/ .
elif [ $1 = "dance" ]
then
dahomey jar
dahomey start ${*:2}
elif [ $1 = "cobspec" ]
then
cd ~/Desktop/dahomey
dahomey router
dahomey jar
runcobspec="nohup java -jar fitnesse.jar -p 9090"
rundahomey="nohup java -jar dahomey.jar -p 5000 -d /Users/mrk/8thlight/cob_spec/public/ -a /Users/mrk/Desktop/dahomey/router.jar"
$rundahomey &
dahomeyprocess=$!
cd ~/8thlight/cob_spec/
$runcobspec &
cobspecprocess=$!
for (( ; ; ))
do
read exit
if [ "$exit" = "exit" ]
then
break
fi
done
kill $dahomeyprocess
kill $cobspecprocess
rm ~/8thlight/cob_spec/nohup.out ~/Desktop/dahomey/dahomey.jar ~/Desktop/dahomey/router.jar ~/Desktop/dahomey/nohup.out
cd ~/Desktop/dahomey/
else
echo "Invalid option. Valid options are:"
echo "'jar' to jar up project"
echo "'start' to run existing and specified jar"
echo "'dance' to jar and run"
echo "'router' to jar up CobSpec router app"
echo "'cobspec' to run CobSpec on port 9090 and Dahomey on 5000 using CobSpec router"
echo "(nothing) to cd to directory"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment