我需要定期在Linux服务器上执行多个shell脚本。 有什么工具在Windows连接到Linux服务器,并执行给定的用户给定的脚本,并显示在Windows机器的输出。
使用plink( http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html ),你也可以使用putty来执行ssh命令,但是你不能得到输出。
C:\>plink.exe -ssh [email protected] -pw mypassword uptime 06:40:58 up 50 days, 3:30, 8 users, load average: 0.00, 0.07, 0.10 C:\>plink.exe -ssh [email protected] -pw mypassword uptime > output.txt C:\>type output.txt 06:41:45 up 50 days, 3:31, 8 users, load average: 0.00, 0.06, 0.09
执行脚本
C:\>type cmd.txt uptime C:\>plink.exe -ssh [email protected] -pw mypassword -m cmd.txt 06:41:45 up 50 days, 3:31, 8 users, load average: 0.00, 0.06, 0.09
你可以使用PuTTY 。 只需使用在服务器上执行脚本的SSH创build保存的会话即可。 它会SSH进入服务器,执行脚本,并显示输出。