Last active
September 9, 2017 05:09
-
-
Save peijiehu/25b55a96e865e9a9357d4efffd59080c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tomcat_pid() { | |
echo `ps -fe | grep $CATALINA_BASE | grep -v grep | tr -s " "|cut -d" " -f2` | |
} | |
start() { | |
pid=$(tomcat_pid) | |
if [ -n "$pid" ] | |
then | |
echo -e "\e[00;31mTomcat is already running (pid: $pid)\e[00m" | |
else | |
# Start tomcat | |
echo -e "\e[00;32mStarting tomcat\e[00m" | |
#ulimit -n 100000 | |
#umask 007 | |
#/bin/su -p -s /bin/sh tomcat | |
if [ `user_exists $TOMCAT_USER` = "1" ] | |
then | |
su $TOMCAT_USER -c $CATALINA_HOME/bin/startup.sh | |
else | |
sh $CATALINA_HOME/bin/startup.sh | |
fi | |
status | |
fi | |
return 0 | |
} | |
status(){ | |
pid=$(tomcat_pid) | |
if [ -n "$pid" ]; then echo -e "\e[00;32mTomcat is running with pid: $pid\e[00m" | |
else echo -e "\e[00;31mTomcat is not running\e[00m" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment