![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | 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. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Passing the values to the secondary script when it invoked by primary script | venu_eie | UNIX for Advanced & Expert Users | 2 | 07-03-2008 08:10 AM |
| Passing the values to the secondary script when it invoked by primary script | venu_eie | Shell Programming and Scripting | 1 | 07-03-2008 07:16 AM |
| create a shell script that calls another script and and an awk script | magikminox | Shell Programming and Scripting | 0 | 06-26-2008 03:50 AM |
| help me in sending parameters from sqlplus script to unix shell script | Hara | Shell Programming and Scripting | 2 | 01-29-2008 03:31 PM |
| Shell Script: want to insert values in database when update script runs | ring | Shell Programming and Scripting | 1 | 10-25-2007 04:06 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Need a little help on a FTP script
Hi there all.. Again ![]() I have a script that will log on to an FTP to get all files back to our server and delete the ones on the other side. Sad enough I cant use Wget. So I build a script to do this with a Mget. But Mget can only get about 1000 characters in 1 line. So I would have to set a limit to reading all the files to maybe 50 lines or someting every list and than stay in a loop till there are no files left on the other side.. Maybe someone can help me changing my script so it will work? The files are called as follow. anna.MM08371053011405 All same length.. only different numbers... This script is working perfect till there are more files dumped to that directory. Thanx in advance!! What I have so far is Code:
RNODE="192.168.10.30"
USER="***"
PASSWD="****"
LOCALDIR="/glims/mgnt/mmpamm"
REMOTEDIR="/"
DIRLISTFILE="${LOCALDIR}/${RNODE}$(basename).dirlist.out"
cat /dev/null > $DIRLISTFILE
DESTINATION=192.168.10.30
HISTLOG=/glims/mgnt/mmpamm/logs/ftphist.log
FTPLOG=/glims/mgnt/mmpamm/logs/ftptrans.log
glimspad=/glims/mgnt/mmpamm
ERROR_FILE=/glims/mgnt/mmpamm/errorfile
HOSTNAME=`uname -n`
##########################################################
############### DEFINE FUNCTIONS HERE ####################
##########################################################
######### Check if there is an error file #########
function errorfile_check
{
if test -r $ERROR_FILE
then
rm $ERROR_FILE
fi
}
######### Ping check if host is avalible #########
function ping_check
{
ping $RNODE -n 2 > $glimspad/pingctrl.txt
PINGCTRL=`cat $glimspad/pingctrl.txt | wc -l`
}
######### ERROR report #########
function report_ERROR
{
echo `date '+%d %b %H:%M:%S'` $RNODE NIET gevonden >> $HISTLOG 2>&1
echo stop `date '+%d %b %H:%M:%S'` >> $HISTLOG 2>&1
touch $ERROR_FILE
echo `date '+%d %b %H:%M:%S'` "communicatie PC: $RNODE" >> $ERROR_FILE
echo "Let op !!!!!" >> $ERROR_FILE
echo "" >> $ERROR_FILE
echo "Fout tijdens overdracht PAMM" >> $ERROR_FILE
exit
}
######### File check from host (FTP) #########
function file_check_host
{
ftp -i -v -n $RNODE <<END_FTP
user $USER $PASSWD
nlist $REMOTEDIR $DIRLISTFILE
bye
END_FTP
}
######### File Copy from host (FTP) #########
function file_copy_host
{
ftp -i -v -n $RNODE <<END_FTP
user $USER $PASSWD
lcd $LOCALDIR
cd $REMOTEDIR
mget `echo $FILESLIST`
bye
END_FTP
}
######### File Remove from host (FTP) #########
function file_remove_host
{
ftp -i -v -n $RNODE <<END_FTP
user $USER $PASSWD
lcd $LOCALDIR
cd $REMOTEDIR
mdelete `echo $FILESLIST`
bye
END_FTP
}
##########################################################
################ BEGINNING OF MAIN #######################
##########################################################
# errorfile_check
ping_check
if pingctrl=7
then
file_check_host
sleep 5
FILESLIST=`cat "$DIRLISTFILE" | tr -d '/'`
file_copy_host
sleep 5
file_remove_host
fi
# End of script
|
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|