如何使windows下的bat文件调用linux下的shell脚本的
背景:写一个bat文件,双击后就可以关闭所有的服务器包括linux服务器和windows服务器
因为公司有这需求,在下班后要关闭所有的服务器
这是shutdown.bat的范例
试验证明,windows可以关闭
#批量关闭windows机器
net use \\192.168.1.124\ipc$ "123456" /user:"administrator"
shutdown -s -f -t 20 -m \\192.168.1.124
#批量关闭linux机器
....待补充....
这是linux下的批量关linux服务器的脚本
suse-linux:/opt/script/shell # ll
total 8
-rw-r--r-- 1 root root 84 May 22 10:33 ip.txt
-rwxr-xr-x 1 root root 179 May 22 10:34 shutdown_boot.sh
suse-linux:/opt/script/shell # cat shutdown_boot.sh
#!/bin/sh
for ip in `cat ip.txt`
do
ssh $ip <<EOF
echo "{$ip} shutdown now..."
init 0
EOF
done
我现在需要做的是,在bat这个文件下调用linux服务器下的shutdown_boot.sh这个文件。
问题就在这里了,不知要怎样让bat调用shutdown_boot.sh这个文件
请各位大神指点迷津。。。
因为公司有这需求,在下班后要关闭所有的服务器
这是shutdown.bat的范例
试验证明,windows可以关闭
#批量关闭windows机器
net use \\192.168.1.124\ipc$ "123456" /user:"administrator"
shutdown -s -f -t 20 -m \\192.168.1.124
#批量关闭linux机器
....待补充....
这是linux下的批量关linux服务器的脚本
suse-linux:/opt/script/shell # ll
total 8
-rw-r--r-- 1 root root 84 May 22 10:33 ip.txt
-rwxr-xr-x 1 root root 179 May 22 10:34 shutdown_boot.sh
suse-linux:/opt/script/shell # cat shutdown_boot.sh
#!/bin/sh
for ip in `cat ip.txt`
do
ssh $ip <<EOF
echo "{$ip} shutdown now..."
init 0
EOF
done
我现在需要做的是,在bat这个文件下调用linux服务器下的shutdown_boot.sh这个文件。
问题就在这里了,不知要怎样让bat调用shutdown_boot.sh这个文件
请各位大神指点迷津。。。
...全文
相关推荐
java在win下启动bat和在linux下启动shell脚本
java的一个工具类,自动判断当前系统,若是window启动bat脚本,若是linux启动linux脚本,执行结果后台打印
运行jar的bat和.sh文件
里边就一个bat文件和.sh文件 开发的普通java程序从ide导出jar,编写bat在windows下运行,编写sh在linux下运行
cmd脚本-bat批处理-shell.zip
cmd脚本-bat批处理-shell.zip
linux-一个多网站监控sh执行的bat
一个监控网站,检测异常并执行脚本的bat
java调用bat批处理与sh脚本
NULL 博文链接:https://xieruilin.iteye.com/blog/719322



