想写个脚本,发现都忘了,蛋疼,一边回忆一边查一边写,总算完成了,贴在下面:

 1 #!/bin/bash
 2 #Program:
 3 #   This program can help you quickly redeploy the project
 4 #History:
 5 # 2017/08/10    shichaogeng    First release
 6 
 7 #variable
 8 jar_file="usp-lm-1.1.4.jar"
 9 project="usp-lm"
10 project_path_prefix="/alidata/projects/"
11 project_path_midfix="/Atomcat/webapps/"
12 project_path_suffix="/WEB-INF/lib"
13 source_path="/alidata/source_code/"
14 
15 #accept the parameters
16 if [ ! -n "${1}"]; then
17     jar_file="${1}"
18 fi
19 if [ ! -n "${2}"]; then
20     project="${2}"
21 fi
22 
23 #judge if exist
24 if [ ! -f "$source_path$jar_file" ]; then
25     echo "The jar is not exist in the path $source_path"
26 fi
27 if [ ! -d "$project_path_prefix$project" ]; then
28     echo "The project is not exist in the path $project_path_prefix"
29 fi
30 
31 #ready
32 cd $project_path_prefix$project$project_path_midfix$project$project_path_suffix
33 rm -rf $jar_file
34 cp $source_path$jar_file ./
35 cd $project_path_prefix$project/Atomcat
36 pid=$(ps x | grep "usp-lm" | grep -v grep | awk '{print $1}')
37 kill -9 $pid 
38 rm -rf logs/*
39 rm -rf work/*
40 
41 #restart
42 ./bin/startup.sh
43 tail -f logs/catalina.out

 写这么个玩意弄了一小时,笑cry。

相关文章:

  • 2021-12-25
  • 2021-12-08
  • 2021-06-23
  • 2022-12-23
  • 2023-02-18
  • 2022-01-02
  • 2021-12-02
猜你喜欢
  • 2021-11-03
  • 2022-12-30
  • 2022-01-31
  • 2021-11-03
  • 2022-12-23
  • 2021-07-07
  • 2021-12-25
相关资源
相似解决方案