标签:int syn roo pre dir web oam block root
这里主要记录一下工作中遇到的一些常用shell
#/bin/bash
export TOMCAT_HOME_PATH=/usr/local/soft/tomcat-8.5.53
cd $TOMCAT_HOME_PATH
#停服;
pid=`ps -ef | grep tomcat | grep -v grep | awk ‘{print $2}‘`
`kill -9 $pid`
#备份war包
date_now=`date ‘+%Y%m%d%H%M%S‘`
`cp ./webapps/demo-0.0.1-SNAPSHOT.jar ./webapps_back/demo-0.0.1-SNAPSHOT.jar_$date_now`
`cp /usr/local/package/demo-0.0.1-SNAPSHOT.jar ./webapps/`
./bin/startup.sh
echo "tomcat start success"
#!/bin/bash
#this is shell local system hadoop send it hadoop system
#if input arguments is not empty
if [ $# -le 0 ]
then
echo "you input arguments is empty"
exit 1;
fi
#get filename and dirname
filename=`basename $1`
dirname=`cd -P $(dirname $1);pwd`
user=`whoami`
for(( host=1;host<=5;host++ ))
do
echo "---------------- hadoop$host begin ----------------"
sync -lrv "${dirname}/${filename} ${user}@hadoop${host}:${dirname}"
#sync -lrv /tmp/a.txt root@hadoop2:/tmp
echo "---------------- hadoop$host end -------------------"
done
#!/bin/bash
if [ $# -le 0 ]
then
echo "you input arguments is empty"
exit 1;
fi
for(( host=1;host<=5;host++ ))
do
echo "---------------- hadoop$host begin ----------------"
ssh "hadoop${host} $@"
echo "---------------- hadoop$host end -------------------"
done
标签:int syn roo pre dir web oam block root
原文地址:https://blog.51cto.com/13733462/2486929