Advertisement
jdgiotta

startup

Jun 15th, 2016
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.07 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # tomcat       Starts Tomcat Java server.
  4. #
  5. #
  6. # description: Tomcat is the server for
  7. # Java servlet applications.
  8.  
  9. export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_91
  10. export JRE_HOME=/usr/lib/jvm/jdk1.8.0_91/jre
  11. export CATALINA_HOME=/usr/local/portal
  12. export CATALINA_BASE=/usr/local/portal
  13. export TOMCAT_USER=tomcat
  14. TOMCAT_USAGE="Usage: $0 {\e[00;32mstart\e[00m|\e[00;31mstop\e[00m|\e[00;32mstatus\e[00m|\e[00;31mrestart\e[00m}"
  15.  
  16. SHUTDOWN_WAIT=20
  17.  
  18. tomcat_pid() {
  19.         echo `ps -fe | grep $CATALINA_BASE | grep -v grep | tr -s " "|cut -d" " -f2`
  20. }
  21.  
  22. start() {
  23.   pid=$(tomcat_pid)
  24.   if [ -n "$pid" ]
  25.   then
  26.     echo -e "\e[00;31mTomcat is already running (pid: $pid)\e[00m"
  27.   else
  28.     # Start tomcat
  29.     echo -e "\e[00;32mStarting tomcat\e[00m"
  30.     #ulimit -n 100000
  31.     #umask 007
  32.     #/bin/su -p -s /bin/sh tomcat
  33.         if [ `user_exists $TOMCAT_USER` = "1" ]
  34.         then
  35.                 su $TOMCAT_USER -c $CATALINA_HOME/bin/startup.sh
  36.         else
  37.                 sh $CATALINA_HOME/bin/startup.sh
  38.         fi
  39.         status
  40.   fi
  41.   return 0
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement