[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple ftp question...



Hi Ken, 

You might try something like this in a ksh or bourne shell script (then automate via cronjob )...  

#/usr/sbin/ping myhost
if [ $? -ne 0 ]
then
  log "ping failed - aborting update"

else
  ftp -n -i myhost <<~
   user userid password
   bin
   cd /home/reports
   lcd /home/reports
   mkdir "$bsv_rpt_dir"
   mkdir "$errors_dir"
   put "$bsv_rpt" "$bsv_rpt_dir"/$bsv_rpt
   put "$bsv_rpt" "/home/reports/bsv/raw"/$bsv_rpt
   put "$usage_rpt" "$usage_rpt_dir"/$usage_rpt
   put "$usage_rpt2" "$usage_rpt_dir"/$usage_rpt2
   put "$acct_rpt" "$acct_rpt_dir"/$acct_rpt
   put "/home/log/$errors" "$errors_dir"/$store.$errors
   lcd /tmp
   get /hours/$hours1 /tmp/$hours1
   get /hours/$hours2 /tmp/$hours2
   get /phones/$ref /tmp/$ref
   cd /usr/bsv/ini
   lcd /usr/bsv
   put "$store".ini
   put "$store"_mdm.ini
   put "$store"_dxcap.ini
   lcd /usr/speech
   cd /usr/bsv/vox
   put "$store"_tkt.vox
   put "$store"_dir.vox
   cd /bsv/ini/ti
   lcd /bsv/ini/ti
   put "$store"_ti.ini
   get /home/bsvadmin/patch_list
   get /phones/REFDESC.DAT /phones/REFDESC.DAT
   quit
~
  log "ftp update done"
fi 

--
#!/usr/bin/rh stop

HTH

---- Ken Keefe <kjkeefe@gmail.com> wrote: 

=============
How can I use ftp in a non-interactive way? I'm looking for something
like I do with ssh:

$ ssh hostname "sequence of semi-colon separated commands"

Thanks,
Ken


-
To unsubscribe, send email to majordomo@silug.org with
"unsubscribe silug-discuss" in the body.

-
To unsubscribe, send email to majordomo@silug.org with
"unsubscribe silug-discuss" in the body.