I have a local text file in windows, it contains multiple shell commands to run on a remote Unix box using putty. The whole process is controlled in groovy script of soap.

Groovy Script, trying to run it ..

def command = "C:/Program Files (x86)/PuTTY/putty.exe -ssh ******@****** -pw ***** -m C:/Users/script/aa.txt" 
def Process p = Runtime.getRuntime().exec(command);

As you see puuty is open with user , pass properly

Contents of aa.txt

sudo su - dev1b

Then it is calling sudo , but not coming out of the command ..so next command also not running.

If I use -t as interactive and just finishing sudo properly , not running next. I want both commands run automatically. Can you suggest how to keep commands in the local file and any mistake in groovy script

closed as unclear what you're asking by Michael Homer, Stephen Rauch, Scott, Anthon, Hauke Laging Aug 28 '17 at 10:49

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    Could you edit your question and improve your description of aa.txt ? sudo is usually interactive and requires a password to be entered. I'm not sure if I've edited your question correctly and lost your intention. Maybe step back and add an explanation as to what you are trying to do ? What happens if you just run your command from a windows shell, forgetting Groovy. – X Tian Aug 24 '17 at 10:32
  • Nutan/nutan: Please read how to join two accounts – Philippos Aug 29 '17 at 5:39

Browse other questions tagged or ask your own question.