Problem with SCP command


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Problem with SCP command
# 1  
Old 11-14-2010
Problem with SCP command

hi,
I am successfully running following command from command prompt
Code:
$ scp oracle@172.16.0.11:/back/crmemo.csv /sales/

but when i am running the same command from a script it copying '?' in sales (destination) folder.

Following is the script
Code:
#!/bin/sh
scp oracle@172.16.0.11:/back/crmemo.csv /sales/
echo "copied"
#


Please help me to resolve the issue Smilie

Last edited by DukeNuke2; 11-14-2010 at 12:31 PM.. Reason: please use "code" tags!
# 2  
Old 11-14-2010
Try with no trailing slash?

Seems like an ssh bug. ssh2 is free and more secure.

Is the target a sym link? You can try "/sales/.".

(Also,use the -d scp option =target-must-be-dir and check $? and report problems!)
# 3  
Old 11-14-2010
I tried without trailing slash but still the same problem... get copied '?' instead of actual file...
# 4  
Old 11-14-2010
Do you get '?' as directory entry /sales/?, or file content /sales/crmemo.csv containing '?' ? Give us a tighter handle:
Code:
ls -ld /sales/*
od -bc /sales/crmemo.csv

# 5  
Old 11-14-2010
On executing the command
[oracle@erp sales]$ ls -ld /sales/*
-rw-rw-r-- 1 oracle oracle 166710 Nov 15 08:54 /sales/?
-------------------------------------------------------------------------------
If i run the same command from command prompt it copies the file successfully

On running same command from script I am getting following message but in sales folder i am getting '?'
crmemo.csv 100% 163KB 162.8KB/s 00:00
--------------------------------------------------------------------------------
# 6  
Old 11-15-2010
MySQL Manoj...basic coomand

[QUOTE=RIAZ;302471629]hi,
I am successfully running following command from command prompt
Code:
$ scp oracle@172.16.0.11:/back/crmemo.csv /sales/

but when i am running the same command from a script it copying '?' in sales (destination) folder.

Following is the script
Code:
#!/bin/sh
scp oracle@172.16.0.11:/back/crmemo.csv ./sales/
echo "copied"
#


Try using this command ie; give(./sales) it may save in the current directory Smilie
# 7  
Old 11-15-2010
not working.... still waiting for some solution Smilie
 
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. Shell Programming and Scripting

scp command problem

I am trying to copy file . On the remote host I have dir structure as ... /opt/product/11.2.0/ and underneath 11.2.0 I have db and db112 dirs.. and there are sub dirs underneath db and db112.. scp xyx:/tmp/1.sh /opt/oracle/11.2.0/*/hs/admin/1.sh the idea here is copy 1.sh to both db... (2 Replies)
Discussion started by: talashil
2 Replies

3. AIX

Problem using scp to transfer a file

I am testing the following command to transfer a file from my server (AIX 5.2) to another server. I was able to generate the keys and sent them the public key. scp -v -P 4030 /home/lawson/.ssh/jimtest.txt someuser@some.ftpsite.net:/Inbound/jimtest.txt > jimtest_out.txt 2>&1 Based on... (3 Replies)
Discussion started by: jyoung
3 Replies

4. UNIX for Advanced & Expert Users

Problem with ssh and scp

Hi there, I'm working with two linux servers and if I use ssh to connect from 1 to 2 everything works fine ( ..as usual:rolleyes:), while if I try to connect via ssh or to copy files through scp (as I usually do...) from 2 to 1, after the password I get this message: Connection closed by... (6 Replies)
Discussion started by: Giordano Bruno
6 Replies

5. Shell Programming and Scripting

scp problem in crontab

Hello there: I hope you can help me. I have this problem: I have the next script: #!/bin/bash #copy all backuped files to main server scp /root/opennms_etc_$fecha.tar.gz opennms2@10.245.10.196: scp /root/opennms_all_$fecha.sql opennms2@10.245.10.196: scp /root/pg_hba.conf ... (2 Replies)
Discussion started by: bobbasystem
2 Replies

6. Shell Programming and Scripting

Problem with SCP parellel processing

Hi All, I am trying to take Bulk Log files from around 24 Remote servers using my shell script. I am using SCP for this. I need to take log files every 15 min, so I am thinking about the parallel processing mechanism in UNIX.The 24 remote machines username,servername reading from properties... (8 Replies)
Discussion started by: scorpio
8 Replies

7. UNIX for Advanced & Expert Users

scp problem

I have some problems using scp between a server Sun Solaris and a SecurePlatform Checkpoint. If I try to copy a simple file txt from the server Sun Solaris to the SecurePlatform, I have problems!!!!!!... server:/export/home/appmgt# scp 1.txt admin2@fwtest:~ lost connection ... if I try to... (5 Replies)
Discussion started by: Minguccio75
5 Replies

8. UNIX for Dummies Questions & Answers

problem with SCP

Hi, I want to copy a file from one system to other i done a SCP but it showing error as below .. Can we do it by SCP ? Is it possible ?.. What is the below mean ?. sys1@sys2's password: scp: .: not a regular file Thanks, Arun (4 Replies)
Discussion started by: arunkumar_mca
4 Replies

9. UNIX for Advanced & Expert Users

scp problem

Hi, I have problem using scp in an AIX machine, where I need to use full path to scp from /dirA but i dont have to from /dirB of the same machine. Below are some details & scp -v output (truncated). I've checked the permission & settings of both dir/FS are the same. Please help. scenario scp... (2 Replies)
Discussion started by: juliehussin
2 Replies

10. UNIX for Advanced & Expert Users

scp problem

I am using scp to get files from a Windows systemr to a Unix system. The ssh server is on Windows. The problem is that the file permissions for files that come from Windows are 700. Can any one help out with how I can set permissions to anything else? (6 Replies)
Discussion started by: blowtorch
6 Replies
Login or Register to Ask a Question