3

I'm attempting to open multiple xterms and run a command as an SAP user via sudo using pssh. So far, I'm able to run PSSH to a file of servers with no check for keys, open every xterm in the servers in the file list, and sudo to the SAP (ADM) user, but it won't do anything else afterwards.

I've tried many combinations and I'm not sure if my options for the pssh nor the xterm options are set correctly. Here is what I have now.

pssh -i -h ectsrv -A -O StrictHostKeyChecking=no "export DISPLAY=IP address:0.0;  xterm -hold -e "sudo /path/sap_sudo.sh" " 

I've tried many combinations: with and without single and double quotes:

xterm -e sudo "cmd1;cmd2;ls;bash"
xterm -e sudo "cmd1 && cmd2"
xterm -e sudo "cmd1;cmd2; ksh"
xterm -e sudo "-tt" "cmd1;cmd2;ls;bash"

I'm completely stuck where SIDADM> is shown in new windows, but it won't run any commands.

2
  • I'm just seeing this while searching for something else. I'm not sure if this will help but I do similiar things using tmux. With a hotkey, I open multiple panes with a different sever in each one. Then with another hotkey, whatever I type in one pane shows on all the panes. So in essence I can enter any command and what I'm typing shows on all terminals simultaneously. If you don't know the tmux tool yo should look into it. It's a more advanced version of screen IMHO. Hope this helps. – Ibrahim Salim Omari Sep 15 '14 at 13:51
  • @IbrahimSalimOmari notes "I do similar things using tmux. With a hotkey, I open multiple panes with a different sever in each one. Then with another hotkey, whatever I type in one pane shows on all the panes. So in essence I can enter any command and what I'm typing shows on all terminals simultaneously. If you don't know the tmux tool yo should look into it. It's a more advanced version of screen IMHO. – drs Sep 15 '14 at 14:11
2

Not sure about the xterm piece however if trying to run multiple commands I had luck doing the following:

pssh -i -h ectsrv -A -O StrictHostKeyChecking=no "sudo cmd1; cmd2"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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