当前位置:文档之家› 启动karaf脚本

启动karaf脚本

#/bin/bash
#
#description:test shell
#
TEST_HOME=/home/niubie/tmp
TEST_BIN=$TEST_HOME/bin
cd $TEST_HOME
echo -e "当前目录:\033[31;1m `pwd` \033[0m"
echo -e "在当前目录下查找文件:\033[31;1m start \033[0m"
read -p "输入你要查找的文件的关键字(不超过3个):" str1 str2 str3
for i in $str1 $str2 $str3;do
if [ -n $i ]; then
find . | grep $i >> test.txt
fi
done
echo -e -n "你要查找的文件如下:\n\033[34;1m `cat test.txt` \033[0m"
echo -e "修改文件权限:\033[31;1m start \033[0m"
echo "文件权限修改后如下:"
for file in `cat test.txt`;do
if [ -n $file ];then
chown -R niubie:niubie $file 2> /dev/null
chmod -R 600 $file 2> /dev/null
echo -e "\033[34;1m `ls -l $file` \033[0m"
fi
done
rm -f test.txt 2> /dev/null
cd $TEST_BIN
echo -e "当前目录:\033[31;1m `pwd` \033[0m"
#service singledaemon stop
echo -e -n "当前karaf进程ID:\n\033[34;1m`ps -ef | grep ping | grep -v grep | awk '{print $1"\t"$2}'` \033[0m\n"
echo -e "重启karaf进程:\033[31;1m start \033[0m"
kill -9 `ps -ef | grep ping | grep -v grep | awk '{print $1"\t"$2}'` &> /dev/null
if [ $? = 0 ];then
# service singledaemon start
# ./karaf &> /dev/null
# ping 10.100.168.125 &> /dev/null
# ping 10.168.172.1 &> /devv/null
echo -e "重启karaf进程:\033[31;1m success \033[0m"
fi
#echo -e -n "当前karaf进程ID:\n\033[34;1m`ps -ef | grep ping | grep -v grep | awk '{print $1"\t"$2}'` \033[0m\n"。

相关主题