Problem while scp if bashrc calls Perl script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problem while scp if bashrc calls Perl script
# 1  
Old 11-12-2009
Problem while scp if bashrc calls Perl script

A weird thing, happened today: When i do SCP from a remote server, file is not getting copied to here.

Application Server: Here is where i work, and have a login. I have several tweaks in .bashrc, and along with all those, today i called a PERL script from bashrc. So when ever i do scp from a remote server to this, as

scp test-file mylogin@server-app

It does not copies the file, also the normal 100% copying thing is also not displayed....

I started debugging, and found that when i have a print statement in the perl program, this is happening. If i comment out all the print statement then copy happens without any issue.

So, could somebody know what is the reason for this ? And how could i have both the thing operational, i want to print, also i would want the copy to happen successfully.
# 2  
Old 11-13-2009
Can you confirm the scp command again? You need add the path next to remote server, such as:

Code:
scp test-file mylogin@server-app:/PATH

# 3  
Old 11-13-2009
Quote:
Originally Posted by rdcwayx
Can you confirm the scp command again? You need add the path next to remote server, such as:

Code:
scp test-file mylogin@server-app:/PATH

Yes, while adding PATH also it is not copying.

What could be the issue ?


Also, i get the following error/warning ( may not be relevant )
Code:
stty: standard input: Invalid argument

# 4  
Old 11-13-2009
Quote:
Originally Posted by thegeek
[...]
Also, i get the following error/warning ( may not be relevant )
Code:
stty: standard input: Invalid argument

It seems the problem is related to the fact that the code is executed in a non-interactive context (no terminal attached).
It should be easier if you post a sample code that we can execute and reproduce the error.

1. Example of the rc file entry.
2. Example of how you are executing the code.

P.S. Try to add the following in the rc file before calling your scp/perl code and see how it behaves:

Code:
[ -t 0 ] && ...

# 5  
Old 11-14-2009
@radoulov


Excellent, and Thanks.

While doing [ -t 0 ] && it works perfectly, also from some 'file test operators' manual i was able to understand this...

Code:
-tfile (descriptor) is 	associated with a terminal device
This test option may be used to check whether the stdin ([ -t 0 ]) or stdout ([ -t 1 ]) in a given script is a terminal.


Reference: Advanced Bash Shell Scripting Guide - File test operators
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Scp, problem, .bashrc

I have a problem with SCP, trying to use this solution in .bashrc: scp printed an error message: "Write failed flushing stdout buffer. write stdout: Broken pipe." or "packet too long". Your shell startup file (e.g., ~/.cshrc, ~/.bashrc), which is run when scp connects, might be writing a... (3 Replies)
Discussion started by: orange47
3 Replies

2. UNIX for Advanced & Expert Users

problem with restarted I/O system calls

Greetings. Suppose I have a UNIX OS with automatic-restart (by default) of interrupted system calls, or I use sigaction() with SA_RESTART flag. If I am in the middle of a read(fd1, buf1, MAXSIZE) or a write(fd2, buf2, MAXSIZE), and I am interrupted by a signal, then the system will... (1 Reply)
Discussion started by: aigoia
1 Replies

3. UNIX for Advanced & Expert Users

perl script to transfer newly generated files by scp

Hi all, I have root directory on server 1 say A and having sub directory B now my application generates output files and put in sub directory B. now i need to transfer these files from server1 to server2 by scp which is having same directory structure A and sub directory B I have tried... (2 Replies)
Discussion started by: tushar_spatil
2 Replies

4. Programming

Problem developing application which calls and displays result of executable

Hi All, i am using ubuntu 10.04 LTS with C2D processor. i want to develop a GUI application in Java using JSwing. This application will call executable present in the local hardisk of linux. The results of this exectuable (moses) must be displayed in TextArea of the application being built. ... (0 Replies)
Discussion started by: n929
0 Replies

5. UNIX for Dummies Questions & Answers

[Solved] startxwin and .bashrc problem

On my old computer I always used "startxwin.bat". This worked well and when it was executed an xterm window would open and the .bashrc file in my /home/username/ folder had been read correctly and all of my aliases worked. However with the newest version of Cygwin I noticed that startxwin.bat is... (3 Replies)
Discussion started by: lemmy
3 Replies

6. Shell Programming and Scripting

Removing banners from scp calls (AIX/KSH)

Hello all! I am creating a script to synchronize key files on multiple servers in our environment. What I have works, but I am getting the banner for each of the servers in the output and it makes it difficult to quickly review when there are over a dozen servers in the array. I have tried a few... (4 Replies)
Discussion started by: cpare
4 Replies

7. Shell Programming and Scripting

Perl System command calls to variable

I am new to scripting in Perl so I have a dumb question. I know I can call system commands using system("date"); But I am not able to: 1. set its output to a variable 2. run in quiet mode(no output to the screen) The examples i have #!/usr/bin/perl print `date +\%y\%m\%d.\%H\%M`;... (5 Replies)
Discussion started by: 4scriptmoni
5 Replies

8. Shell Programming and Scripting

How to scp as different user in perl script

Hi, I am writing a perl script that needs to change to a another user and scp files to a remote server. The passwords should not be prompted but read from a config file. Please help. Thanks Sandeep (4 Replies)
Discussion started by: sdubey
4 Replies

9. IP Networking

Identification of data calls & voice calls

Is there any facility to filter/identify the data calls and voice calls coming throug modem? OR Can we get the data or voice calls information through a script(preferably C Kermit)? (0 Replies)
Discussion started by: pcsaji
0 Replies

10. Shell Programming and Scripting

problem in getting the path of environment variable set in bashrc in my shell script

hi all i have joined new to the group. i have set an variable in my bashrc file. .bashrc PROGHOME=/home/braf/braf/prog export PROGHOME but while using it in my shell script its path is not taken and i had to explicitly give the export command to set the path. in my script... (8 Replies)
Discussion started by: krithika
8 Replies
Login or Register to Ask a Question