3

I have some quick questions about PuTTY using remote commands (-m).

I have MachineB which is having simple easy to fix issue. To connect to MachineB I have to connect to ServerA, grab an IP address and SSH to MachineB:

ssh -t -t `cat /Devices/051`

From here I set a series of commands and at the end I check the outputs:

cd /opt/ProgramA/
/opt/ProgramA/reboot.sh
/opt/ProgramA/Validate.sh

After checking the outputs I would be done and good to go.

I currently have:

Putty.exe -ssh hostissecret 22 -l root -pw secret -m command.txt

Commands.txt contains:

ssh -t -t `cat /Devices/051
cd /opt/ProgramA/
/opt/ProgramA/reboot.sh
/opt/ProgramA/Validate.sh
read

It does get me into MachineB but does not run any commands on it. I have also tried making the command.txt one long line but PuTTY will exits without enough of a time lapse to complete the commands.

1 Answer 1

2

You need quotation marks around the group of commands that run on machine B, so that ssh sees them as a single argument, and semicolons to let the shell on B know where each command ends.

ssh -t -t `cat /Devices/051` "cd /opt/ProgramA/; /opt/ProgramA/reboot.sh; /opt/ProgramA/Validate.sh"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .