first step
Create a new directory in the root directory: mkdir directory name
Remove directory command: rm -rf directory name
Create a new .sh file into the directory, touch test.sh
I compiled into the
#! / bin / SH
A = 0 COUNT = 0 # script location SHELL_PATH = / root / Deploy position #tomcat of TOMCAT_PATH = / usr / local / tomcat position # project deployment TOMCAT_WEBAPPS = $ TOMCAT_PATH / webapps # immediate concern tomcat process the AUX PS | grep tomcat | grep -v grep | awk '{Print $ 2}' | xargs the kill -9 # delete all the logs under tomcat RM -rf $ TOMCAT_PATH / logs / * RM -rf $ TOMCAT_PATH / Work / * # start Tomcat $ TOMCAT_PATH / bin / startup.sh # view the log tail -f $ TOMCAT_PATH / logs / catalina.out
: Wq save and exit
To test.sh given executable permissions, chmod + x test.sh
./test.sh run the script