Want to write a script, found that all forget, egg pain, while recalling the side of the writing, finally finished, affixed to the following:
1#!/bin/Bash2 #Program:3 # can help you quickly redeploy the project4 #History:5# ./ ,/TenShichaogeng First release6 7 #variable8jar_file="Usp-lm-1.1.4.jar"9project="USP-LM"Tenproject_path_prefix="/alidata/projects/" Oneproject_path_midfix="/atomcat/webapps/" Aproject_path_suffix="/web-inf/lib" -Source_path="/alidata/source_code/" - the #accept The Parameters - if[!-N"${1}"]; Then -jar_file="${1}" - fi + if[!-N"${2}"]; Then -project="${2}" + fi A at#judgeifexist - if[!-F"$source _path$jar_file"]; Then - Echo "The jar is not a exist in the path $source _path" - fi - if[!-D"$project _path_prefix$project"]; Then - Echo "The project is not a exist in the path $project _path_prefix" in fi - to #ready + CD $project _path_prefix$project$project_path_midfix$project$project_path_suffix - RM-RF $jar _file the CP$source _path$jar_file./ *CD $project _path_prefix$project/Atomcat $pid=$ (PSx |grep "USP-LM"|grep-Vgrep|awk '{print $}')Panax Notoginseng Kill-9$pid - RM-RF logs/* the RM-RF work/* + A #restart the ./bin/startup.sh + tail-f logs/catalina.out
Write this thing for an hour, laugh cry.
Shell Script Combat