当我们使用PuTTY / Plink运行命令时,我们可以保存执行日志 [英] Can we save the execution log when we run a command using PuTTY/Plink

查看:742
本文介绍了当我们使用PuTTY / Plink运行命令时,我们可以保存执行日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Plink在远程机器上运行命令。为了完全自动化过程I
需要将执行日志保存在某处。我使用的是bat文件:

I am using Plink to run a command on remote machine. In order to fully automate the process I need to save the execution log somewhere. I am using a bat file:

C:\Ptty\plink.exe root@<IP> -pw <password> -m C:\Ptty\LaunchFile.txt

C: \ Ptty\LaunchFile.txt 包含我要运行的命令。

The C:\Ptty\LaunchFile.txt contains my command that i want to run.

./Launch.sh jobName=<job name> restart.mode=false

是否有一种方法来保存执行日志, ...?

Is there a way to save the execution log so that I can monitor it later... ?

推荐答案

plink 是一个控制台应用程序。实际上,这可能是唯一的目的。因此,其输出可以重定向到文件,就像任何其他命令行命令/工具一样。

The plink is a console application. Actually that's probably it's only purpose. As such, its output can be redirected to a file as with any other command-line command/tool.

以下示例将标准和错误输出重定向到文件 output.log

Following example redirects both standard and error output to a file output.log:

plink.exe -m script.txt username@example.com > output.log 2>&1

另请参见将stdout和stderr重定向到单个文件

这篇关于当我们使用PuTTY / Plink运行命令时,我们可以保存执行日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆