Linux shortcut launches Tomcat
1. Script Path/etc/init.d/tomcat
First execution: Vi/etc/init.d/tomcat
Press A to edit, the following content according to your own situation (mainly to modify the/usr/local/tomcat6/bin/)
After modifying the copy to the edit box, ESC exits the edit: Wq Save exit
Java code
#!/bin/bash
# Description:start or stop the Tomcat
# Usage:tomcat [Start|stop|reload|restart]
#
Export path= $PATH: $HOME/bin
Export bash_env= $HOME/.BASHRC
Export Username= "root"
Case "$" in
Start
#startup the Tomcat
Echo-n "Tomcat Start:"
Cd/home/tomcat-bdcserver/bin
./startup.sh
echo "Tomcat started"
Tail-f/home/tomcat-bdcserver/logs/log.log# Print Log
;;
Stop
# Stop Tomcat
Echo-n "Tomcat Stop:"
Ps-ef | grep "Java" | Grep-v grep | Sed ' s/[]*/:/g ' |cut-d:-f2| Kill-9 ' Cat '
Cd/usr/local/tomcat6/work
RM-RF Catalina
echo "Tomcat stopped"
;;
Reload|restart)
$ stop
$ start
;;
*)
echo "Usage: Tomcat [Start|stop|reload|restart]"
Exit 1
Esac
Exit 0
2. Change the tomcat script to an executable file
Java code
chmod +x/etc/init.d/tomcat
3. In order to execute this script on any path, it needs to be added to the/usr/bin directory
Java code
1.[[email protected]]# Cd/usr/bin
2. [Email protected]]# ln-s/etc/init.d/tomcat.
Linux Tomcat quick Action