Skip to content

Instantly share code, notes, and snippets.

@isurfer21
Last active December 11, 2019 02:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isurfer21/2bd511cc80e258048777c84a11855a1f to your computer and use it in GitHub Desktop.
Save isurfer21/2bd511cc80e258048777c84a11855a1f to your computer and use it in GitHub Desktop.
Shell based Apache Tomcat agent
#!/usr/bin/env sh
APP_VER="19.9.20"
version() {
echo " Version $APP_VER \n"
}
help() {
echo "\n Apache Tomcat Agent version $APP_VER \n Copyright (c) 2019 Abhishek Kumar. All rights reserved."
echo "\n Options:"
echo " -v --version to see the current version of the app"
echo " -h --help to see the menu of command line options"
echo "\n Commands:"
echo " start to start the tomcat server"
echo " restart to restart the tomcat server"
echo " stop to stop the tomcat server"
echo "\n Please choose accordingly. \n"
}
if [[ "$1" == "" ]]; then
echo " Command missing! \n"
else
cd $ROOT_DIR
case "$1" in
'start')
echo " Start the tomcat server"
$CATALINA_HOME/bin/catalina.sh start
;;
'restart')
echo " Restart the tomcat server"
$CATALINA_HOME/bin/catalina.sh restart
;;
'stop')
echo " Stop the tomcat server"
$CATALINA_HOME/bin/catalina.sh stop
;;
'-v')
version
;;
'--version')
version
;;
'-h')
help
;;
'--help')
help
;;
esac
fi
exit 0
@isurfer21
Copy link
Author

isurfer21 commented Sep 20, 2019

$ tomcat -h

 Apache Tomcat Agent   version 19.9.20 
 Copyright (c) 2019 Abhishek Kumar. All rights reserved.

 Options:
  -v --version    to see the current version of the app
  -h --help       to see the menu of command line options

 Commands:
  start           to start the tomcat server
  restart         to restart the tomcat server
  stop            to stop the tomcat server

 Please choose accordingly. 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment