Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get return code from plink?

In a DOS batch script, I'm running a single command on a remote (also windows) computer using plink. Formerly, this command was only run on the local machine, and was relying on the return code to determine success. Is there a way to easily get this information back through plink?

like image 380
Nate Avatar asked Nov 03 '10 18:11

Nate


People also ask

What is plink command?

Plink (PuTTY Link) is a command-line connection tool similar to UNIX ssh . It is mostly used for automated operations, such as making CVS access a repository on a remote server.

Does plink use SSH?

More typically Plink is used with the SSH protocol, to enable you to talk directly to a program running on the server.

How do I exit a Plink session?

If you are running plink then at the end of your command, create a new line and use the command EXIT and that should do it.


1 Answers

That's not possible with plink. The current consensus is to have the remote script echo its exit code to a log file, then use pscp to transfer the log file to the local machine.

See http://fixunix.com/ssh/74235-errorlevel-capturing-plink.html.

like image 159
Frédéric Hamidi Avatar answered Oct 05 '22 17:10

Frédéric Hamidi