怎么使windows下的bat文件调用linux下的shell脚本的

如何使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这个文件

请各位大神指点迷津。。。

找个win版的ssh客户端,里面都会带ssh-keygen2.exe,用它生成一对密钥,目录看软件设置,一般都会有提示生成在哪个目录,带.pub的是公钥,传到你要远程的服务器上的 ~/.ssh/目录,配置好sshd服务,允许公钥认证。
看图吧:

测试:

怎么使windows下的bat文件调用linux下的shell脚本的

相关文章:

你感兴趣的文章:

标签云: