飞天使-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"
相关推荐
biubiubiu07061 天前
Linux 与 Shell 自动化运维基础知识记录
linux·运维·自动化
默|笙1 天前
【Linux】进程概念与控制(2)_进程控制
java·linux·策略模式
代码AC不AC1 天前
【Linux】关于 mmap 文件映射
linux·mmap 文件映射
me8321 天前
【Linux】解决Docker-Compose拉取Jenkins时失败问题。
linux·docker·jenkins
kaoa0001 天前
Linux入门攻坚——73、运维OS Provisioning阶段工具之PXE、Cobbler
linux·运维
Lugas Luo1 天前
SATA Port Multiplier (SATA 集线器) 原理与驱动架构深度剖析
linux·嵌入式硬件
123过去1 天前
fcrackzip使用教程
linux·网络·测试工具·安全
水月天涯1 天前
Mac系统下制作 Ubuntu镜像(小白教程)
linux·ubuntu·macos
A.A呐1 天前
【Linux第二十三章】传输层
linux·运维·服务器
Yupureki1 天前
《Linux网络编程》1.网络基础
linux·运维·服务器·c语言·网络·c++