tags:

views:

249

answers:

2

Hi.

I need to make a graphic interface in Lazarus from which I run miscelaneous commands on 12 remote computer nodes. Some of these commands never exit/return (for example I also start daemons). This graphic interface needs to separate the user (beginner level) from the overwhelming complexity of Linux.

I intend to run miscelaneous tools and scripts via SSH. I have tried to run SSH (passwordless) in TProcess but it is not working. For this, I have tried the 2nd, 3rd and 4th TProcess example posted on Lazarus' official web page (http://wiki.lazarus.freepascal.org/Executing%5FExternal%5FPrograms). The 4th is for "big output" - when the program generates more than 2KB of output. Anyway, the test program freezes or it is not capturing the output from SSH. Anybody succesfully used TProcess to run both small and big-output applications?

PS: I am on linux, nodes are also on linux. Please let me know also if you have other ideas about how to do this from Lazarus - maybe something that not necessarly involves SSH and/or TProcess, though I don't know if it is possible without them.


Solved.

I think it was a glitch in the SSH bacause all examples that didn't work yesterday are working today. Also I have changed TProcess.Options to also capture the StdError output.

A: 

First thing is, can you get TPRocess to call a simple ssh command which completes and just outputs the information to a file using a file redirector (e.g. ssh ls > output)?

RobS
Hi RobS.No. The content of the output file is the listing on MY current home folder instead of the remote computer. (Using: "ssh remote_server_name ls > output.txt").This will not work anyway because I don't know when the remote process exits. I want to execute some daemons which takes 0-15 seconds to start/stop.
Altar
Can you not wrap the starting and stopping of the daemons inside a script on the ssh host which, when finished, outputs a magic-phrase on stdout which you can wait for and detect?
RobS
A: 

Solved.

I think it was a glitch in the SSH bacause all examples that didn't work yesterday are working today. Also I have changed TProcess.Options to also capture the StdError output.

Altar