如何使windows下的bat文件调用linux下的shell脚本的方法

2025-04-07 15:29:08
推荐回答(1个)
回答1:

背景:写一个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#
lltotal 8-rw-r--r-- 1 rootroot 84 May 22 10:33 ip.txt-rwxr-xr-x 1 root
root 179May 22 10:34 shutdown_boot.shsuse-linux:/opt/script/shell# cat
shutdown_boot.sh#!/bin/shfor ip in `cat ip.txt`do ssh $ip
<0EOFdone我现在需要做的是,在bat这个文件下调用linux服务器下的shutdown_boot.sh这个文件。问题就在这里了,不知要怎样让bat调用shutdown_boot.sh这个文件病毒。