The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Problem with csh script rahulrathod Shell Programming and Scripting 4 02-21-2008 12:38 PM
script problem tdavenpo Shell Programming and Scripting 3 01-04-2006 04:07 PM
Problem starting a script from a 'main'-script Rakker UNIX for Dummies Questions & Answers 3 06-28-2005 09:12 AM
problem with a script Lestat Shell Programming and Scripting 4 06-13-2005 01:30 PM
problem with ftp script...please help vancouver_joe UNIX for Advanced & Expert Users 2 11-22-2001 07:47 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 11-25-2005
reebz reebz is offline
Registered User
  
 

Join Date: Nov 2005
Posts: 5
FTP Script Problem

Hi,

Firstly, I would like to admit that I am a scripting newb.

Now, to my question:


I am writing a script that FTPs a bunch of logs from one server to another, it will be scheduled in Cron to run every 20 minutes.

Currently, the file transfer part of the script is fine. However, when the logs are transferred from server A to B, I want to delete the copies on server A, but I am unable to get the return code.

Here is my script so far:



Code:
#	
#	22-11-2005
#	John
#	T&A Website
#
#	Automates the FTP transfer of logs from A to B.
#

cd /x/logs/TAWEB

ftp -nv star-d << !
quote USER test
quote PASS testpass
cd /x/logs/TAWEB
mput *

if [[ $? ]]; then
	echo FTP_OK!
	rm DAILY*
	rm STATS*
else
	echo FTP_FAIL!	
fi

quit
!

However, I am getting the error:


Code:
....
?Invalid command
....

multiple times (once for each log that exists).

As far as I knew, $? is the variable where the last return code was stored, but it doesn't seem to be working in this case.


I'm not sure how to check if the transfer was a success or not.

Thanks in advance for any help.


EDIT: Forgot to mention I am using KSH shell.
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:55 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0