I need to automate the following workflow.

  1. Copying a file (say inputfile.txt) to a remote machine (fixed ip) through SSH

  2. Logging into that remote machine through SSH (using Remote Desktop Viewer of ubuntu)

  3. Running a particular command with that file (inputfile.txt) as parameter.

    mycommand -option inputfile.txt
    

I need to be able to right click the file and choose "Execute my mycommand" context menu (Nautilus) item which will run the command in the remote machine. (and hopefully show a message box with the result - not that necessary)

Need suggestions on how to do it.

EDIT: Figured out copy works this way. Any idea on how to integrate into nautilus menu. Also the following command prompts for password

scp -r inputfile.txt user@machine.domain:/home/userremote/Documents

link|improve this question

76% accept rate
Do you truly need to run the command using remote desktop? It would e far easier if you could execute the command over SSH, possibly using X forwarding if it's truly a GUI application. – Flimzy Jul 12 '11 at 3:47
feedback

1 Answer

GUI-Programs aren't always easily automated.

The first challenge is the nautilus-script.
What does it contain?

cat ~/.gnome2/nautilus-scripts/mycommand

Maybe you can do it in a more direct way.

cat inputfile.txt | ssh REMOTE "mycommand"

or

cat inputfile.txt | ssh REMOTE "cat - > tmp.txt; ~/.gnome2/nautilus-scripts/mycommand -option tmp.txt"

or with two commands, scp first.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.