The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
A Batch job to delete files from various directories guruparan18 Shell Programming and Scripting 3 05-10-2008 01:31 PM
batch delete using find, files with # character tphyahoo UNIX for Dummies Questions & Answers 0 05-30-2006 09:05 AM
Converting Shell script to Dos batch files darwinkna Shell Programming and Scripting 1 05-12-2006 08:01 AM
Looping/Repetition in Batch files kimpot7268 Shell Programming and Scripting 2 12-12-2005 04:45 AM
Looping/Repetition in Batch files kimpot7268 UNIX for Advanced & Expert Users 1 12-10-2005 12:49 AM

Closed Thread
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-16-2001
ober5861's Avatar
Registered User
 

Join Date: Jul 2001
Location: Gettysburg, PA
Posts: 116
Batch files and FTP under Unix

Hey all,

Does anyone know if Unix has an equivalent to a batch file? And if so, does it work the same way as a batch file under windows?

AND, if you can answer that one, is it possible to run such a file under HP-UX and have it execute while in an FTP command line? What I need to do is backup some data onto an NT server from the HP-UX setup in a routine matter and I was wondering if I could nearly automate the process. Any help would be appreciated.

ober5861
Forum Sponsor
  #2 (permalink)  
Old 07-16-2001
Registered User
 

Join Date: May 2001
Location: Allentown, PA
Posts: 54
Hi, ober

You can write a simple shell script to automate an ftp process, similar to a win batch file. Check out Heiner's Shelldorado at http://oase-shareware.org/shell/ for scripting resources. The ftp man page on your system will help, too.

To schedule the ftp process, you can make an entry in your crontab. (man cron or man crontab).
  #3 (permalink)  
Old 07-16-2001
ober5861's Avatar
Registered User
 

Join Date: Jul 2001
Location: Gettysburg, PA
Posts: 116
Talking

Thanks a bunch! I'm not the best at writing shell scripts at this point, but I guess there's no better time to start, right?
  #4 (permalink)  
Old 07-16-2001
Registered User
 

Join Date: Jul 2001
Location: California
Posts: 42
Cool

if you want ftp to be done automatically, here is a file called ".netrc" (see man page .netrc)

However, there is a security risk to run this one since password(s) will be on this file;
make sure to delete this file after runing your cron job(s) or shell script(s).
Hope this help
__________________
:rolleyes:
  #5 (permalink)  
Old 07-16-2001
Registered User
 

Join Date: Apr 2001
Posts: 25
Lightbulb

This is a typical "batch" ftp script we run all the time:

#!/usr/bin/ksh

## put server name or IP address of FTP server
## provide username & password for the ftp server
## cd to whatever directory you want to put files to or get files from
## issue get or put commands -
## Anything you can do on a command line can be inside this script
ftp -n -v ipaddress <<-ENDTAG
user username password
cd dir
get file1
prompt
mget filepattern*
ENDTAG

Google UNIX.COM
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 06:49 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0