docker exec -it $adx adb shell am start -n com.im.datacollectworknode$idx/com.im.datacollectworknode$idx.MainActivity
done
elif [[ $info =~ ".ini" ]]; then
log "$adx /sdcard/myconfig/路径下包含.ini"
strconf=$(docker exec -it $adx adb shell "ls /sdcard/myconfig/ | tr '\n' ' '")
log $strconf
docker进入容器
array=(`echo $strconf` )
for((m=0;m<${#array[@]};m++)) do
config=${array[$m]};
configval="config$1.ini"
if [ $config != $configval ]; then
log "docker exec -it $adx adb shell mv /sdcard/myconfig/$config /sdcard/myconfig/config$1.ini"
docker exec -it $adx adb shell mv /sdcard/myconfig/$config /sdcard/myconfig/config$1.ini
fi
done
for((idx=1;idx<=5;idx++)); do
log "docker exec -it $adx adb shell am start -n com.im.datacollectworknode$idx/com.im.datacollectworknode$idx.MainActivity"            docker exec -it $adx adb shell am start -n com.im.datacollectworknode$idx/com.im.datacollectworknode$idx.MainActivity
done
else
log "异常"
fi
}
str=$(docker ps -a | sed 's/[ ]\{1,10\}/||/g')
list=(${str/\n/ })
log "list长度:"${#list[@]}
for((j=$containerStartIndx;j<=$containerEndIndex;j++)); do
exist="0"
adx=ad$j
log "adx:"$adx
for(( i=1;i<${#list[@]};i++)) do
item=${list[$i]};
ad=$(echo $item | awk -F\| '{print $NF}')
log "ad:"$ad
if [[ $ad = $adx ]]; then
exist="1"
log "item:"$item;
log "$adx已存在:$ad"
if [[ $item =~ "unhealthy" ]]||[[ $item =~ "Created" ]]; then
log "$adx需要重启,重启中……: docker restart $adx"
rs=`docker restart $adx`
sleep 2m
elif [[ $item =~ "Exited" ]]; then
# ⽆法重启的报错:Error response from daemon: Cannot restart container
# if [[ $rs =~ "Error response from daemon: Cannot restart container" ]]; then
log "重启失败,即将删除容器,并重建:docker rm $adx"
docker rm $adx
exist="0"
else
log "正常运⾏中, 或starting 或 healthy"
fi
log "exist1:"$exist
break
fi
done
log "exist2:"$exist
if [ $exist = "0" ]; then
log "$adx没有启动,启动中……"
if (($j<10));then
log "docker run --privileged -d -p 600$j:6080  -e DEVICE='Nexus 5' --name $adx xhs/7.0"
docker run --privileged -d -p 600$j:6080  -e DEVICE='Nexus 5' --name $adx xhs/7.0
else
log "docker run --privileged -d -p 60$j:6080  -e DEVICE='Nexus 5' --name $adx xhs/7.0"
docker run --privileged -d -p 60$j:6080  -e DEVICE='Nexus 5' --name $adx xhs/7.0
fi
sleep 2m
log "重命名完成!"
fi
setEnv $j

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。