文章目录
- jenkins配置的方式
- jenkins中执行shell的思路
jenkins配置的方式
jenkins中执行shell的思路
下面的脚本别照抄,只是一个思路
ipall="$ips"# 将文本参数按行输出为变量
while IFS= read -r line; doecho "$line"
if [[ ! -z $line ]] && [[ $add == 'true' ]];then
for ip in ${line[@]}
dossh 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' ]]; thenecho "remove"#d=$(echo $ip |sed 's,/,\\/,g')
for ip in ${line[@]}
dod=$(echo $ip )echo $dssh 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"
elseecho "notgood"
fi
done <<< "$ipall"