Sh3ll
OdayForums


Server : Apache
System : Linux server1.cgrithy.com 3.10.0-1160.95.1.el7.x86_64 #1 SMP Mon Jul 24 13:59:37 UTC 2023 x86_64
User : nobody ( 99)
PHP Version : 8.1.23
Disable Function : NONE
Directory :  /opt/cpanel/ea-tomcat85/bin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/cpanel/ea-tomcat85/bin/user-init.sh
. /opt/cpanel/ea-tomcat85/bin/user-functions
. $HOME/ea-tomcat85/bin/setenv.sh
 
tomcat_pid() {
  if [ -n "$CATALINA_PID" ] && [ -e $CATALINA_PID ]; then
      cat $CATALINA_PID
  fi
}

ERROR=0
case $1 in
    start)
        pid=$(tomcat_pid)
        if [ -n "$pid" ] && ps --pid $pid 2>&1 1>/dev/null; then
            echo -e "\e[00;33mTomcat is already running (pid: $pid)\e[00m"
            ERROR=1
        else
            /opt/cpanel/ea-tomcat85/bin/user-startup.sh
        fi
        ;;
    stop)
        pid=$(tomcat_pid)
        if [ ! -n "$pid" ] || [ ! ps --pid $pid 2>&1 1>/dev/null ]; then
            echo -e "\e[00;31mTomcat is already shutdown\e[00m"
            ERROR=1
        else
            /opt/cpanel/ea-tomcat85/bin/user-shutdown.sh
        fi
        ;;
    restart|force-reload|reload)
        pid=$(tomcat_pid)
        if [ -n "$pid" ] && ps --pid $pid 2>&1 1>/dev/null; then
            /opt/cpanel/ea-tomcat85/bin/user-shutdown.sh
        fi

        /opt/cpanel/ea-tomcat85/bin/user-startup.sh
        ;;
    status|fullstatus)
        pid=$(tomcat_pid)
        if [ -f "$CATALINA_PID" ]; then
            if ps --pid $pid 2>&1 1>/dev/null; then
                echo -e "\e[00;32mTomcat is running!\e[00m"
                ERROR=0
            else
                echo "$CATALINA_PID found, but $pid is not running"
                ERROR=4
            fi
        else
            echo -e "\e[00;31mTomcat is currently not running.\e[00m"
            ERROR=3
        fi
        ;; 
    *)
        echo $"Usage: $0 {start|stop|restart|status|fullstatus}"
        ERROR=2
esac
 
exit $ERROR

ZeroDay Forums Mini