如何使用批处理和登录打开putty然后在bash上执行命令列表

sha*_*eef 1 bash putty batch-file sunos

我有一个配置了oracle的Sun OS服务器; 与数据库11g我想要备份,现在我在putty控制台上使用ssh连接到终端但是,我需要的是找到一种方法,使用批处理连接ssh到服务器然后登录然后登录到oracle然后采取备份,是可能的,如何.

sha*_*eef 10

如果你真的想使用putty来执行此操作,可以在Windows的命令提示符中使用以下命令(这将打开putty及其终端并在您的文本文件中执行传递的参数):

putty.exe plink  -ssh -load profileName -l username -pw password -m commandPath -t
Run Code Online (Sandbox Code Playgroud)

要么

putty.exe -ssh username@ip -pw password -m commandPath
Run Code Online (Sandbox Code Playgroud)

例如:

putty.exe -ssh rootz@10.10.10.10 -pw rootzpass -m c:\commands\mycommands.txt
Run Code Online (Sandbox Code Playgroud)

其中profileName是保存在putty中的配置文件,commandPath是包含您要执行的命令的本地目录文本文件,用户名是服务器用户,ip是服务器的IP地址,密码是您的服务器密码然后您可以在textFile中输入你想要的任何命令.

参考 the.earth putty文档

  • 对于无法使其工作的人,请检查 [this](https://superuser.com/a/1010093/740762) (2认同)