Linux小脚本

    将固定的换包步骤,做成脚本replacePackage.sh,赋予执行权限(chmod +x   replacePackage.sh)。这样小小自动化也能节约时间呀。

 

replacePackage.sh内容:

timeStamp=$(date +%F-%H-%M-%S)
cd XXXX
mv $1.war $1.war-bak-$timeStamp
mkdir $1.war
mv *.war $1.war
cd $1.war
unzip *.war

  

 

  脚本使用(进入脚本所在目录,针对test.war包):

./replacePackage.sh  test

 

重启jboss服务脚本:

pid_java=""
pid_java=$(ps -ef | grep java | grep -v grep | awk '{print $2}')
echo $pid_java
if [ -n "$pid_java" ]
  then
  echo "kill java process... The pid is $pid_java "
 $(kill -9 "$pid_java")
fi
$(nohup standalone.sh &)   #还有问题???

 

posted @ 2016-07-19 10:52  jht_newbie  阅读(203)  评论(0编辑  收藏  举报