首页 > 代码库 > 使用shell数组重启tomcat
使用shell数组重启tomcat
#!/bin/bash
tomcat1="/usr/local/tomcat1/"
tomcat2="/usr/local/tomcat2/"
tomcat3="/usr/local/tomcat3/"
tomcat4="/usr/local/tomcat4/"
tomcat=($tomcat1 $tomcat2 $tomcat3 $tomcat4)
#for((i=0;i<${#tomcat[@]};i++));do
# ${tomcat[$i]}bin/shutdown.sh >> /dev/null 2>&1
# sleep 2
# ${tomcat[$i]}bin/startup.sh >> /dev/null 2>&1
# echo ${tomcat[$i]} restart OK
#done
#array
echo ${tomcat[@]}
echo ${tomcat[@]:1}
echo ${tomcat[@]:0:2}
echo ${tomcat[@]:0:1}
echo ${tomcat[@]:1:2}
echo ${tomcat[@]:1:3}
exit
#array Len
echo ${#tomcat[*]}
echo ${#tomcat[@]}
#Del array
unset tomcat[0]
echo ${tomcat[@]}
unset tomcat
echo ${tomcat[@]}
本文出自 “我是一只小小鸟” 博客,请务必保留此出处http://2242558.blog.51cto.com/2232558/1545316
使用shell数组重启tomcat