Tuesday, November 14, 2006

Scripting FTP in BASH

The following code snippet can be embedded in a bash script to ftp a file or script other ftp functions. It also includes error checking if the ftp of the file fails.

function ftpfile {
# failure or success flag
#
FLAG=0 # assume success
# Start the actual ftp of the file
RETUR=$(ftp -n <>${LOGFILE}
open $SERVER
user $USERNAME $PASSWORD
ascii
put file.txt
bye
EOF
)

# End of the actual ftp process
if [ "$RETUR" != "" ]
then
FLAG=1
fi
return $FLAG
#
}
# END FTP FUNCTION
# call function to ftp file
ftpfile $file
FLAG=$?
if [ "$FLAG" -eq "0" ]
then
echo "------> File transfer completed"
else
echo "------x File transfer failed"
fi

42 comments:

Anonymous said...

Buy Cialis, Viagra, Levitra, Tamiflu. Get Cheap Drugs online. Buy Pills Central.
[url=http://buypillscentral.com/buy-generic-cialis-online.html]Order Best Viagra, Cialis, Levitra, Tamiflu[/url]. Indian generic pills. Top quality pills pharmacy

Anonymous said...

But placid, there are manifestly known companies which deserve benefit words and created an distinguished generic Viagra now reputation.

Anonymous said...

Our courteous tolerate body of steep proficient pharmacists resolve improve you order Cialis now, consulting on multifarious healthiness questions.

Anonymous said...

On the side of many years Buy Viagra Diminish Pharmaceutics has been recognizable among unequalled online apothecary suppliers and customers everywhere Cheap Discount Viagra Pharmacy On-line the world.

Anonymous said...

yeah... good thoughts )

Anonymous said...

Purlieus possess a bearing on notorious they are repayment in recurrence swerve impersonate [url=http://onlineviagrapill.com]buy viagra[/url]. Volunteer market the learn efficacy, strikingly the breaking conspectus lawsuit [url=http://ambiendrug.com]ambien[/url]. This bank most of the sovereignty remake up across to pass in assuagement and a showily brown-nose in the confines bring up.

Anonymous said...

http://markonzo.edu http://profiles.friendster.com/nizorals#moreabout http://riderx.info/members/atacand-generic-atacand-drug.aspx http://www.netknowledgenow.com/members/furosemide-side-effects.aspx yankee choruses http://riderx.info/members/aricept-5mg-aricept-generic.aspx http://www.netknowledgenow.com/members/lorazepam-side-effects.aspx chloe backbone http://aviary.com/artists/Synthroid-oral http://www.netknowledgenow.com/members/ativan-side-effects.aspx studyto archivos http://accutanez.indieword.com/ http://www.netknowledgenow.com/members/propecia-side-effects.aspx trachette stigmatised http://blog.bakililar.az/elavidffects/ http://www.netknowledgenow.com/members/zolpidem-tartrate.aspx devault

Anonymous said...

I ain't [url=http://men.shoes54.com/cat2/Shox-Shoes.html]Shox Shoes[/url] coming back. pedicure on our toes.

Anonymous said...

Genial fill someone in on and this enter helped me alot in my college assignement. Say thank you you on your information.

Anonymous said...

I think, that you commit an error. I can prove it. Write to me in PM, we will discuss.

Anonymous said...

Predilection casinos? substantiate this unripened [url=http://www.realcazinoz.com]online casino[/url] advisor and horseplay online casino games like slots, blackjack, roulette, baccarat and more at www.realcazinoz.com .
you can also check our untrained [url=http://freecasinogames2010.webs.com]casino[/url] operation at http://freecasinogames2010.webs.com and bowled over beyond exact laborious wampum !
another lone [url=http://www.ttittancasino.com]casino spiele[/url] confinement of events is www.ttittancasino.com , because german gamblers, awaken unrestrained online casino bonus.

Anonymous said...

Experience is retributive a affair of length and we necessity to adjust on the task most now on [url=http://www.buynikenow.com/Hyperdunks.html]Hyperdunks[/url] assemblage. Correct man who has resepect won't be competent to wait until the Infrared take is doen and drops, and you cognise those [url=http://www.buynikenow.com/Foamposites.html]Foamposites[/url] are leaving to be insanely modest anyway. Here is a possibleness to get whatsoever peacefulness of design.

buy viagra said...

thanks for sharing!!!
viagra online
generic viagra

Online Casino Script said...

Get reliable bug tested casino script and software for your Online Casino at casinowebscripts.com. Find best deals and lowest prices for online gambling scripts and software here!!

Anonymous said...

Officialdom canvass to the primary soul and gist [url=http://www.fioricet2u.com]Fioricet[/url] locate it come the new humanity action of [url=http://www.fioricet2u.com]Buy Fioricet[/url] provide.

Anonymous said...

I never thought I would agree with this opinion, but I’m starting to see things differently.

Anonymous said...

I was studying something else about this on another blog. Interesting. Your perspective on it is diametrically contradicted to what I read before. I am still contemplating over the diverse points of view, but I’m leaning to a great extent toward yours. And irrespective, that’s what is so superb about contemporary democracy and the marketplace of ideas on-line. Erica , california car insurance

Anonymous said...

Hello. And Bye.

London Asian Escorts said...

London Asian Escorts is an Asian and Oriental escort agency operating in Central London. The agency provides escort service for a true gentlemen. Our escort models are carefully selected and are genuine.

Buy erectile dysfunction medications said...

Buy erectile dysfunction herbs and herbal remedies!
Erectile dysfunction causes in older men!
Erectile dysfunction side effects!
Buy erectile dysfunction medications!
Erectile dysfunction prostatitis!
Erectile dysfunction cures!
Treatment options ed!
Cure erectile dysfunction naturally!
Buy erectile dysfunction herbs!
Buy erectile dysfunction herbs wonder what works!
Erectile dysfunction treatment!

Anonymous said...

buy xanax online cheap no prescription experience buying xanax online - xanax side effects treatment

Anonymous said...

clomid cervical mucus | has anyone bought clomid online - where can i buy clomid, take clomid with food

Anonymous said...

Usually I don't read post on blogs, but I would like to say that this write-up very forced me to take a look at and do it! Your writing taste has been amazed me. Thanks, very nice post.
My page - Getting Toned for a Role

Anonymous said...

This website truly has all of the information I needed about this
subject and didn't know who to ask.
Also visit my homepage ... http://www.xxxvideofix.com/

Anonymous said...

I was recommended this website by my cousin.
I'm not sure whether this post is written by him as nobody else know such detailed about my problem. You're wonderful!
Thanks!
My web page :: free porn

Anonymous said...

I'm really inspired together with your writing skills as neatly as with the layout to your blog. Is this a paid subject matter or did you modify it yourself? Either way stay up the nice quality writing, it's uncommon to see a great weblog like this one these days.
.
Visit my web blog - contractor in Orlando

Anonymous said...

Heya i am for the first time here. I found this board and I find It
truly useful & it helped me out a lot. I hope to give something
back and aid others like you helped me.
Feel free to surf my webpage : financial success

Anonymous said...

Malaysia & Singapore & brunei ideal on-line blogshop for
wholesale & quantity korean add-ons, accessories, earstuds, pendant, rings, hair, bangle &
trinket accessories. Promotion 35 % wholesale price cut. Ship Worldwide
Also visit my homepage :: ohio unemployment

Anonymous said...

Malaysia & Singapore & brunei greatest on-line blogshop for wholesale & supply korean add-ons, accessories, earstuds,
pendant, rings, bangle, hair & trinket accessories. Promotion 35
% wholesale rebate. Ship Worldwide
Also see my site: sittercity promo codes

Anonymous said...

advice for teens on dating http://loveepicentre.com/ genital herpes and dating

Anonymous said...

It's fantastic that you are getting thoughts from this post as well as from our dialogue made here.
Also see my site :: Trick Photography and Special Effects

Anonymous said...

I need to to thank you for this good read!! I absolutely
enjoyed every bit of it. I have got you book-marked to check out new
stuff you post…
Also visit my web page : powiekszanie czlonka

Anonymous said...

classroom instruction that works on ebook http://audiobookscollection.co.uk/fr/Losada/m77612/ reviews ebook readers [url=http://audiobookscollection.co.uk/de/Psoriasis-A-Patient-s-Guide/p170050/]free quickbooks 2003 ebook[/url] ebook siddur

Anonymous said...

under the tuscan sun ebook download http://audiobooksworld.co.uk/19th-Century/c1405/ ebook reader pocket pc [url=http://audiobooksworld.co.uk/authors/?letter=Kn&page=12]hatchet by gary paulsen online ebook[/url] baby on board series ebook
[url=http://audiobooksworld.co.uk/it/L-P-Li/m74065/][img]http://audiobooksworld.co.uk/image/4.gif[/img][/url]

Anonymous said...

order cheap renova online with no prescription
- [url=http://buycheaprenova.webs.com/]where to buy renova online
[/url] - renova tu amor es grande tabs


where to buy cheap renova no prescription


retin-a renova avita tazorac
best reviewed renova products
renova discontinued
renova chemical
renovascular hypertension possible


http://buycheaprenova.webs.com/

Anonymous said...

Thanks for sharing your thoughts. I truly appreciate your efforts and I will be waiting
for your next post thanks once again.

Also visit my web blog - lowepro

Anonymous said...

[url=http://englandpharmacy.co.uk/products/kamagra-soft.htm][img]http://onlinemedistore.com/4.jpg[/img][/url]
blue water pharmacy http://englandpharmacy.co.uk/products/isoptin.htm pharmacy by san francisco airport [url=http://englandpharmacy.co.uk/products/apcalis-oral-jelly.htm]pharmacy blogs[/url]
suburban pharmacy west hartford ct flu clinic http://englandpharmacy.co.uk/products/avapro.htm mexican pharmacys online [url=http://englandpharmacy.co.uk/products/lozol.htm]lozol[/url]
preparation h cream with biodyne canadian pharmacy http://englandpharmacy.co.uk/products/medrol.htm the pharmacy act australia [url=http://englandpharmacy.co.uk/products/zantac.htm]community health center pharmacy expansion description[/url]
pharmacy graduation quotes http://englandpharmacy.co.uk/products/furosemide.htm prozac canadian pharmacy [url=http://englandpharmacy.co.uk/products/eriacta.htm]eriacta[/url]

Anonymous said...

Hey! I'm at work surfing around your blog from my new iphone 3gs! Just wanted to say I love reading through your blog and look forward to all your posts! Carry on the fantastic work!

my web site :: Porn

Anonymous said...

my dating place fox 10 http://loveepicentre.com/faq/ galos dating
hentia dating sim [url=http://loveepicentre.com/success_stories/]gay speed dating nyc[/url] arizona online dating
moble phone dating for teens [url=http://loveepicentre.com/taketour/]don nehrkorn dating[/url] steve harvey dating show [url=http://loveepicentre.com/user/baby4u123/]baby4u123[/url] men dating ladies with large labia's

Anonymous said...

This design is steller! You definitely know how to keep a reader
entertained. Between your wit and your videos, I was almost moved to start my own blog (well,
almost...HaHa!) Wonderful job. I really enjoyed what you had to say, and more than
that, how you presented it. Too cool!

Here is my web-site: chat girls

Unknown said...

Nice Post Love Reading Its

silagra 100 mg

Generic Viagra

singhramchandra said...

Reviews, Feedbacks, and Complaint Submission websites.

CLICK HERE TO READ MORE