飞天使-jenkins进行远程linux机器修改某个文件的思路

文章目录

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"
相关推荐
orion571 天前
Missing Semester Class1:course overview and introduction of shell
linux
用户120487221611 天前
Linux驱动编译与加载
linux·嵌入式
用户805533698031 天前
Input 子系统架构:Core、Handler、Driver 三层是怎么协作的
linux·嵌入式
用户805533698031 天前
RK-Forge外设系列开篇 - 把板子从「能启动」变成「能用」:Ethernet/SPI/MMC 三个纯接线外设
linux·github·嵌入式
七歌杜金房2 天前
我终于又有了自己的 Linux 电脑
linux·debian·mac
tntxia3 天前
linux curl命令详解_curl详解
linux
扛枪的书生3 天前
Linux 网络管理器用法速查
linux
顺风尿一寸3 天前
Java Socket 内核之旅:从 SocketChannel.read() 到 tcp_recvmsg 与 epoll 的完整调用链路
linux
XIAOHEZIcode3 天前
Ubuntu 终端美化全栈指南:Bash 到 Kitty 踩坑实录
linux·ubuntu·命令行
唐青枫4 天前
别再只会用 cron:Linux systemd Timer 定时任务实战详解
linux