文章目录
- jenkins配置的方式
- jenkins中执行shell的思路
jenkins配置的方式
jenkins中执行shell的思路
下面的脚本别照抄,只是一个思路
ipall="$ips"
# 将文本参数按行输出为变量
while IFS= read -r line; do
echo "$line"
if [[ ! -z $line ]] && [[ $add == 'true' ]];then
for ip in ${line[@]}
do
ssh root@10.0.0.1 "echo $ip "
ssh root@10.0.0.1 "echo $ip >> /tmp/deny_ip.cl"
done
elif [[ ! -z $line ]] && [[ $remove == 'true' ]]; then
echo "remove"
#d=$(echo $ip |sed 's,/,\\/,g')
for ip in ${line[@]}
do
d=$(echo $ip )
echo $d
ssh root@10.0.0.1 "sed -i '/^$d$/d' /tmp/deny_ip.cl"
#ssh root@10.0.0.1 "sed -i 's@\<$d\>@en@d' /tmp/deny_ip.cl"
done
elif [[ $check == 'true' ]]; then
ssh root@10.0.0.1 "cat /tmp/deny_ip.cl"
else
echo "notgood"
fi
done <<< "$ipall"