Pass Multiple Commands and Open Multiple Xterms via PSS


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Pass Multiple Commands and Open Multiple Xterms via PSS
# 8  
Old 08-06-2014
You can use the -n and/or -T options to change the name displayed on the window and/or icon (if you iconify it).

And you CAN'T pass multiple commands to xterm:

xterm(1): terminal emulator for X - Linux man page

Quote:
-e program [ arguments ... ]

This option specifies the program (and its command line arguments) to be run in the xterm window. It also sets the window title and icon name to be the basename of the program being executed if neither -T nor -n are given on the command line. This must be the last option on the command line.
# 9  
Old 08-06-2014
Thanks. I was able to get a prompt with my user id.

Attempted to build from there... with
Code:
pssh -i -v -h ectsrv -A -O StrictHostKeyChecking=no  "export DISPLAY=IP:0.0;  xterm -hold -e bash sudo /path/sap_sudo.sh"

got the error: /usr/bin/sudo: /usr/bin/sudo: cannot execute binary file

* I also tried
Code:
/usr/bin/sudo /path/sap_sudo.sh

same error

Last edited by Franklin52; 08-07-2014 at 03:13 AM.. Reason: Please use code tags
# 10  
Old 08-06-2014
What is /path/sap_sudo.sh ? What does it do? How is it used?

Quote:
Originally Posted by icemanj
got the error: /usr/bin/sudo: /usr/bin/sudo: cannot execute binary file
You're trying to feed bash something that's not a shell script... Namely, you're trying to feed it /usr/bin/sudo. Wouldn't you rather have sudo run bash instead? Smilie

Code:
pssh -i -v -h ectsrv -A -O StrictHostKeyChecking=no "export DISPLAY=IP:0.0; xterm -hold -e sudo bash"

# 11  
Old 08-07-2014
Hey I figured it out. I should've tried this in the first place, but
I was so determined on the other method.

Code:
Pssh -i -h server.txt ...."export display 1
Ip:0.0; xterm -e script.sh

In the script
Code:
Echo "cmd"|sudo /path/sudo script.sh"


And those xterms opened up simultaneously as the right user and executed
commands and displayed the output all each server like I wanted!!!

Thanks to everyone for all of your kind feedback in such a timely manner.

Last edited by Don Cragun; 08-07-2014 at 02:49 PM.. Reason: Add CODE tags.
This User Gave Thanks to icemanj For This Post:
# 12  
Old 08-07-2014
Quote:
Originally Posted by icemanj
Hey I figured it out. I should've tried this in the first place, but
I was so determined on the other method.

Code:
Pssh -i -h server.txt ...."export display 1
Ip:0.0; xterm -e script.sh

In the script
Code:
Echo "cmd"|sudo /path/sudo script.sh"


And those xterms opened up simultaneously as the right user and executed
commands and displayed the output all each server like I wanted!!!

Thanks to everyone for all of your kind feedback in such a timely manner.
Moderator's Comments:
Mod Comment Please learn to use CODE tags as required by forum rules. The moderators should not have to edit every post you submit.

I am very glad that you have something that is working for you. What shell are you using. Most shells would give you a syntax error for both of those commands due to unmatched double quotes.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with bash script to open arbitrary # of independent xterms

I run multiple processes that require I pop open multiple xterms, how can I do this in a script and have each xterm colored differently and labled for the servername they represent, for example if I do ssh username@serverip I would need the xterm to be opened with that servername at the top and... (3 Replies)
Discussion started by: smth333
3 Replies

2. Shell Programming and Scripting

Is is possible to pass multiple entries in PS3 select ?

PS3="Enter corresponding number and hit enter:" select DIR in `cat mylist` QUIT do if then echo "INVALID INPUT" else if ; then my commands ..... else break fi fi REPLY='' done The above will return something like below : Select from the list of... (4 Replies)
Discussion started by: ningy
4 Replies

3. Shell Programming and Scripting

How to automatically pass 'multiple' user inputs

Hi Everyone, 1) I really cannot figure out how to pass multiple user inputs in a script. really need your help re this. below is the script. ----------- #!/bin/sh # script name: ask.sh echo "Enter name: \c" read NAME echo "Your name is $NAME\n" echo "Enter age: \c" read AGE echo... (5 Replies)
Discussion started by: mcoblefias
5 Replies

4. UNIX for Dummies Questions & Answers

multiple text edits inone pass

File_1 looks like: bunch of text Untitled Placemark bunch of text bunch of text Untitled Placemark bunch of text bunch of text Untitled Placemark bunch of text File_2 looks like: Title_001 Title_002 Title_003 First: I need to replace the 1st occurence of "Untitled Placemark"... (2 Replies)
Discussion started by: kenneth.mcbride
2 Replies

5. Shell Programming and Scripting

perform 3 awk commands to multiple files in multiple directories

Hi, I have a directory /home/datasets/ which contains a bunch (720) of subdirectories called hour_1/ hour_2/ etc..etc.. in each of these there is a single text file called (hour_1.txt in hour_1/ , hour_2.txt for hour_2/ etc..etc..) and i would like to do some text processing in them. Each of... (20 Replies)
Discussion started by: amarn
20 Replies

6. Programming

Control multiple program instances - open multiple files problem

Hello. This shouldn't be an unusual problem, but I cannot find anything about it at google or at other search machine. So, I've made an application using C++ and QtCreator. I 've made a new mime type for application's project files. My system (ubuntu 10.10), when I right click a file and I... (3 Replies)
Discussion started by: hakermania
3 Replies

7. Solaris

Help with executing multiple remote commands after multiple hops

Hi SSHers, I have embedded this below code in my shell script.. /usr/bin/ssh -t $USER@$SERVER1 /usr/bin/ssh $USER2@S$SERVER2 echo uptime:`/opt/OV/bin/snmpget -r 0 -t 60 $nodeName system.3.0 | cut -d: -f3-5` SSH to both these servers are public-key authenticated, so things run... (13 Replies)
Discussion started by: LinuxUser2008
13 Replies

8. Shell Programming and Scripting

Commands to multiple xterms

Hi, I need some help with sending commands to multiple xterms. What I do is ssh -Y to a remote box, and then open up 4 shells (csh) and on each one I run a different program in sequence -- one of them has 2, the first of which goes into the background and after you hit "enter" or "return" you get... (0 Replies)
Discussion started by: rmoriarty
0 Replies

9. Shell Programming and Scripting

How do we pass multiple arguments into awk

How do we pass multiple arguments into awk : name=john age=12 now i have to pass both age and name into awk.. how to do it? like : awk -v var=... (4 Replies)
Discussion started by: abhinav192
4 Replies

10. UNIX Desktop Questions & Answers

resize multiple xclients (xterms) on command line or programmatically?

Is there a way to resize x clients after they're started either on the command line or programmatically? I'm using Cygwin and typically start my root window, wm, and four xterms. By the end of the day they're all over the place with different sizes. I'd like to be able to enter a single command... (0 Replies)
Discussion started by: gctaylor
0 Replies
Login or Register to Ask a Question