|
Search Forums:
|
|||||||
| Forums | Register | Forum Rules | Linux and Unix Links | Man Pages | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
scp is not working through sh script
Hi All, I am generating a ~ delimited file from oracle table and then transfer it to another server through scp. Code:
if [ -f $COM_DIR/ABC.txt ] then scp $COM_DIR/ABC.txt unix.nam.nsroot.net:/home/magna/dum/ABC.txt else echo "File does not exist, please check" >>$LOG fi The script generates the file, but not able to deliver it to another server. To check what is the problem with scp command, i have tried to redirect the output to the LOG file like... Code:
if [ -f $COM_DIR/ABC.txt ] then scp $COM_DIR/ABC.txt unix.nam.nsroot.net:/home/magna/dum/ABC.txt >> $LOG else echo "File does not exist, please check" >>$LOG fi but still it is not working. While i executed only the scp command on command prompt, it works. Can someone tell me what could be a problem? |
| Sponsored Links | |
|
|
|
#2
|
||||
|
||||
|
I too tried with scp in script and it got work,check the returned error.
And one more thing you can not capture the error by using '>>'.It is used to redirect the stdout to a file not stderr. |
| Sponsored Links | ||
|
|
|
#3
|
||||
|
||||
|
"It's not working" is about as useful as telling your doctor "it hurts".
What error messages do you get in your logfile (which you should redirect stderr to too, using '2>>$LOG')? Are you running the script as your user, or as a different id? By hand, or via an automated mechanism like cron? |
|
#4
|
|||
|
|||
|
Is it producting any error message.?
It seems your script looks okay... |
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
The problem is it is not producing any error message.
|
| Sponsored Links | |
|
|
#6
|
||||
|
||||
|
use -v option to debug Code:
scp -v $COM_DIR/ABC.txt unix.nam.nsroot.net:/home/magna/dum/ABC.txt >> $LOG
-v Verbose mode. Causes scp and ssh(1)
to print debugging messages about
their progress. This is helpful in
debugging connection, authentica-
tion, and configuration problems. |
| Sponsored Links | |
|
|
#7
|
|||
|
|||
|
Code:
if [ -f $COM_DIR/ABC.txt ] then scp $COM_DIR/ABC.txt unix.nam.nsroot.net:/home/magna/dum/ABC.txt 1> /usr2/spool/out1.txt 2> /usr2/spool/out2.txt else echo "File does not exist, please check" >>$LOG fi Note: Change log path name. Last edited by pludi; 03-10-2010 at 06:34 AM.. Reason: code tags, please... |
| Sponsored Links | ||
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| script not working | ShinTec | UNIX for Dummies Questions & Answers | 3 | 01-22-2010 07:26 AM |
| Perl script 'system' linking to local shell script not working | phpfreak | Shell Programming and Scripting | 5 | 10-16-2009 04:56 AM |
| Script not working with SCO | wollop | Shell Programming and Scripting | 4 | 03-20-2009 12:20 PM |
| Script not working..."sort" not working properly.... | Rahulpict | Shell Programming and Scripting | 23 | 03-16-2009 10:13 AM |
| Pls. Help my script not working as it should | cocoabeauty1 | Shell Programming and Scripting | 1 | 07-28-2007 05:11 PM |
|
|