Shell scripting errors for ftp process


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell scripting errors for ftp process
# 1  
Old 06-03-2014
Shell scripting errors for ftp process

Hi i am facing problem in shell scripting for ftp process getting following errors
here is the script & result
Code:
vi GtpTxnlogs_ftp.sh
"GtpTxnlogs_ftp.sh" 40 lines, 921 characters
#!/usr/bin/bash
######################################################################################
# Copyright (coffee) 2012-2013 by Roamware Inc.
#
# Script name: GtpTxnlogs_ftp.sh
#
# Description: This script FTPes the gtptxn files to RQM App server IP
#
# Date: 05-Aug-2013
#
######################################################################################
#
#. /opt/Roamware/scripts/setup.sh
#DIRECTORY DETAILS
LOG_DIR=/opt/Roamware/logs/cron/
logfile=GtpTxnlogs_ftp.log
> $LOG_DIR/$logfile
SUMM_OFFLINE=/opt/Roamware/logs/rqm/traces/summary/offline/
DET_OFFLINE=/opt/Roamware/logs/rqm/traces/detail/offline/
echo "start" >> $LOG_DIR/logs/$logfile
FTPUSER="roamware"
cd $SUMM_OFFLINE
scp /opt/Roamware/a_tmp/dkprobe* $FTPUSER@ IP/opt/Roamware/a_tmp/
put GtpTxnlogs_ftp.log
quit
END_SCRIPT
echo "FTP Completed to RQM App server..."
 
~
~
~
"GtpTxnlogs_ftp.sh" 40 lines, 922 characters
[04:05:27:roamware@JF-Probe]>GtpTxnlogs_ftp.sh
./GtpTxnlogs_ftp.sh: line 26: /opt/Roamware/logs/cron//logs/GtpTxnlogs_ftp.log: No such file or directory
dkprobe.20130604-234 100% |*****************************************************
./GtpTxnlogs_ftp.sh: line 33: put: command not found
./GtpTxnlogs_ftp.sh: line 35: quit: command not found
./GtpTxnlogs_ftp.sh: line 36: END_SCRIPT: command not found
FTP Completed to RQM App server...



Moderator's Comments:
Mod Comment Please use code tags next time for your code and data. Thanks

Last edited by Sarmistha; 06-03-2014 at 09:08 AM.. Reason: Due to wrong title
# 2  
Old 06-03-2014
Below line has error
Code:
echo "start" >> $LOG_DIR/logs/$logfile

Check if the file /opt/Roamware/logs/cron//logs/GtpTxnlogs_ftp.log already exists and if you have permissions to write to that file.
But, you are using 2 log files here > $LOG_DIR/$logfile and $LOG_DIR/logs/$logfile

and what is END_SCRIPT in the script. I guess the scp part of the script has to be in a code block and you have enclosed the block with END_SCRIPT.
In that case you haven't started the block correctly
# 3  
Old 06-03-2014
thanks

but is this script is correct ,if not could you plz help me to correct it
# 4  
Old 06-03-2014
First, edit your post to use code-tags. Select the code and hit this icon

Second, Never ever, directly post the "real" script. Always change the confidential information like servername, credentials, paths etc.

Third, Use some appropriate subjects instead "Help me". Better to read the forum rules here.

Your scripts has multiple issues. Did you write the script yourself? Or took it form somewhere?
You see, you have used scp and later used the real ftp commands like put,quit etc.

My understanding is, you have mixed two different type of scripts.
the plain ftp script which uses here-document and other which uses scp.

Please check with the source of the scripts.
the hint is, scp directly copies the file across the server. You dont need to put the file explicitly.

Last edited by clx; 06-03-2014 at 07:47 AM.. Reason: forum rules
This User Gave Thanks to clx For This Post:
# 5  
Old 06-03-2014
Please use code tags as required by forum rules!

Your script is not correct, there are error msgs:
Code:
./GtpTxnlogs_ftp.sh: line 26: /opt/Roamware/logs/cron//logs/GtpTxnlogs_ftp.log: No such file or directory
dkprobe.20130604-234 100% |*****************************************************
./GtpTxnlogs_ftp.sh: line 33: put: command not found
./GtpTxnlogs_ftp.sh: line 35: quit: command not found
./GtpTxnlogs_ftp.sh: line 36: END_SCRIPT: command not found

Your code snippet is 27 lines, but the error msgs are referring to lines up to 36 - where are the missing lines?
Err msg in line 26 has //logs in it - where does this come from? Not from the LOG_DIR and logfile variables?
You're using the bash shell - that does not have put nor quit commands; these sound more like ftp, whilst there's no ftp called anywhere.
This User Gave Thanks to RudiC For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

FTP a file using Shell Scripting (Help needed)

the requirements is to have a linux script which connects to a windows machine using ftp command and check for a flag file if found copy a .csv file into current machine. (3 Replies)
Discussion started by: tradingspecial
3 Replies

2. Shell Programming and Scripting

Scripting with FTP Process

Hi Guys, Good day ULF! I have a general "auto-ftp" code which looks something like this: #!/bin/sh cd $1 ftp -v -n $2 << EOF user $3 $4 prompt cd $5 bin mput $6 quit EOF This works pretty well, but I'm thinking of how can I make a code by maybe including on this code, for... (5 Replies)
Discussion started by: rymnd_12345
5 Replies

3. Shell Programming and Scripting

How to stop the process in shell scripting?

Hi all, I have tried the below code to execute. #! /bin/bash date1=`date -d "today 08:00:00" +%s` date2=`date -d "today 08:01:00" +%s` path=/home/user01/red/IDC/sample cd $path java Cspsamp 111.19.5.172 7025 rd1 rd1 "5022=Query|5026=109378|4=627|5=E:VD|5042=$date1|5049=$date2"... (5 Replies)
Discussion started by: aish11
5 Replies

4. Shell Programming and Scripting

Shell Scripting not showing in process when it goes to sleep

Hi All, Here is my script: sleep_time=`echo "9.6 * $num_servers"|bc| cut -d. -f1` if ; then sleep_time=3600;fi ### Allow the compare script to kick in after 1 hour at the least logger "Sleeping for $sleep_time seconds ...Will call compare.sh thereon" $act_log sleep $sleep_time #sleep... (3 Replies)
Discussion started by: ntgobinath
3 Replies

5. Shell Programming and Scripting

FTP-Shell scripting

Hi Everybody, I have come across a problem while doing FTP using shell scripting. So I request any of you can give some idea of how to go about solving the problem but i request you not to give the solution please. Because i'm a java developer newly into Unix shell progrmming and am very enthu... (1 Reply)
Discussion started by: RSC1985
1 Replies

6. UNIX for Dummies Questions & Answers

Wait Process in Shell Scripting.

Hello, I have a script that needs to wait till the previous process is done within the same script.But my script doesnt wait till that it is done.Can anyone suggest how I can stop my process till the previous task is done. I tried 'wait' but I dont have a static process id so is there... (2 Replies)
Discussion started by: sud
2 Replies

7. Shell Programming and Scripting

Shell scripting - FTP

Can some one help with script to track ftp logins on AIX server.. (1 Reply)
Discussion started by: ddk2oo5
1 Replies

8. Shell Programming and Scripting

Background Process Shell Scripting

I have a following program: echofunc() { filename=$1 echo "reading $filename" while read line do echo $line; sleep 6; done < $filename } split -5 new.dat ls x* > input.dat while read file do echofun $file & done < input.dat (3 Replies)
Discussion started by: dhieraj
3 Replies

9. Shell Programming and Scripting

scripting a ftp process

I am trying to automate a process in one of two ways: 1) ftp .txt files from a unix server to a Windows 2000 server. I want to do this in a script. Can I supply the login and password to the Windows server inside the script? 2) I tried this and failed: sftp .txt files from the unix server to... (2 Replies)
Discussion started by: gbernard
2 Replies

10. UNIX for Dummies Questions & Answers

questions on ftp shell scripting

did a search but was not allowed to use 'ftp' because its too short of a word. for some reason, i can't seem to remember anything about ftp shell scripts - would someone please refresh my memory on the syntax and maybe give a short example? thanks for the time. (5 Replies)
Discussion started by: psyjoniz
5 Replies
Login or Register to Ask a Question