Visit Our UNIX and Linux User Community


Display problem when running a remote script


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Display problem when running a remote script
# 1  
Old 05-14-2012
Display problem when running a remote script

Hi,

Quick question, someone will hopefully be able to stop me from Smilie.

I currently have a script which calls a script on a remote machine and captures the stdout to a file:

Code:
ssh <user>@<server> > output 2>/dev/null <<_EOF
/path/script.ksh
_EOF

This runs the script but the stdout is badly formatted. The output is an sql and the data is not displayed in column. I.E.

Code:
 
FIELDA FIELDB FIELDC FIELDD
AAAAA 0         ABCD   EFGH
BBBBB 0         ABCD   EFGH
CCCCC      0         ABCD   EFGH
DDDDD      0         ABCD   EFGH
EEEEE 0         ABCD   EFGH

If the script is run locally on the machine, however, the display is correct. I.E. (they should all be in line Smilie)

Code:
 
FIELDA FIELDB FIELDC FIELDD
AAAAA 0         ABCD   EFGH
BBBBB  0         ABCD   EFGH
CCCCC 0         ABCD   EFGH
DDDDD 0         ABCD   EFGH
EEEEE  0         ABCD   EFGH

Any ideas?
# 2  
Old 05-14-2012
That is usually caused by default tab stops in the terminal setting. Check the TERM variable in the remote session. Check man terminfo (or termcap) to see if your terminal type is supported. If you ssh in to the local host from a PC, check what kind of terminal emulation you are using. Example: if you come in as a vt220 and the remote thinks you are something else, things can get garbled.

Try: Run the job in background on the remote box, Spool to a local file, then scp the file back home. Getting the right terminal setting is easier.
# 3  
Old 05-15-2012
Hi Jim,

Thanks for the info. Checked the TERM variable on both servers and they both display as vt100.

Looking at the man page I'm having trouble seeing the wood for the trees. I'll persevere, but not holding my breath.
# 4  
Old 05-15-2012
Tty the -n switch on the ssh line .
# 5  
Old 05-17-2012
Thanks for the suggestion, but that just returns the banner and not the output frrom the sql.
 

Previous Thread | Next Thread
Test Your Knowledge in Computers #1011
Difficulty: Easy
The number 128 in base 10 equals 10000000 in base 2.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Running script on remote server

Hi All, I need to run a ksh script on around 200 servers(consisting of AIX,LInux,HP-UX,Solaris). The script is there in the /tmp directory of all the servers. I want want to execute the script in background on the respective servers and then exit from there. I have written something like below:... (8 Replies)
Discussion started by: proactiveaditya
8 Replies

2. Shell Programming and Scripting

How to display information of the script while its running?

how to display the messages on screen IN PERL such as " 1. Entering while loop" if the script enters a while loop. 2. Checking FILENAME. etc... 3. Print statement is also not helpful.... (1 Reply)
Discussion started by: Rashid Khan
1 Replies

3. Solaris

Cygwin/X Remote connection frozen display problem

Hello, We are using Solaris 2.5.1 box. And we are accessing to Solaris from Windows xp using Cygwin/X. The connection establish without any problem and we can use desktop environment. But, sometimes later ( various between 2 minutes to 10 minutes ) Connectted desktop display is frozen. Mouse is... (4 Replies)
Discussion started by: summerboy
4 Replies

4. UNIX for Advanced & Expert Users

Script running on remote machine - How ??

Hi All, This was an interview question " There is a clean-up shell-script in one UNIX machine and it is connected to 100 other UNIX machines. Howe can we run the script on all the 100 machines without ftping/copying the script to target machines ? I was unable to answer, please answer if... (5 Replies)
Discussion started by: coolbhai
5 Replies

5. Shell Programming and Scripting

Problem running ssh from remote server

So I have a script which performs some basic commands on another server via ssh. It works great, no issues at all. Let's call this "Script A" BUT, this working script is to be executed remotely from a different UNIX script on another server, also by ssh. Let's call this "Script B". When... (1 Reply)
Discussion started by: newerakb
1 Replies

6. Shell Programming and Scripting

Problem with running the remote script

Hi All, I am running a script which is present on remote machine using ssh command. the remote script is failing when try to load a property file. It says file does not exist. Any idea what should be the problem for this. Thanks Supriya. (7 Replies)
Discussion started by: supriyabv
7 Replies

7. Shell Programming and Scripting

How to stop a script running in remote server from local script

Hi, I have googled for quite some time and couldn't able to get what exactly I am looking for.. My query is "how to stop a shell script which is running inside a remote server, using a script"??? can any one give some suggestions to sort this out. (1 Reply)
Discussion started by: mannepalli
1 Replies

8. UNIX for Advanced & Expert Users

Running script on remote machine

if i have a script in my system which i need to run on remote system using ssh, how shall i do it? One easy way to to first scp it to remote machine and then run it on remote machine using ssh. Is there any one step way to do it. Preferably one in which i should give password only once (3 Replies)
Discussion started by: vickylife
3 Replies

9. Shell Programming and Scripting

Running a Script in a Remote server

I am trying to write a script that would let me run a command in a remote server using ssh. scriptA: (dcm2nii is a command that only works on the other server) dcm2nii a b c scriptB: (I run this one on the current server) ssh -X otherserver /home/abc/Desktop/scriptA But when I do ... (2 Replies)
Discussion started by: ZeroGPX
2 Replies

10. Shell Programming and Scripting

running a script on remote server.

I need to run a script on a remote server from my ksh script. The issue I'm having is that I need to logon to the remote server as a different user. (see the following) logged on to server 1 as adsmgr neet to log on to server 2 as odemgr run passwd_util.ksh Thanks in advance. (1 Reply)
Discussion started by: whited05
1 Replies

Featured Tech Videos