Skip to content

Instantly share code, notes, and snippets.

@peijiehu
Last active September 9, 2017 05:09
Show Gist options
  • Save peijiehu/25b55a96e865e9a9357d4efffd59080c to your computer and use it in GitHub Desktop.
Save peijiehu/25b55a96e865e9a9357d4efffd59080c to your computer and use it in GitHub Desktop.
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