Home > Archive > Linux/Unix > August 2001 > FTP Script





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author FTP Script
Randy

2001-07-24, 3:10 pm

Recently I had to write an FTP script that would FTP a report to a server automatically. I couldn't find any of these on the net, so I came up with the following solution. I made two files, one called "patronload" with the following contents:

#!/usr/bin/sh
/usr/bin/ftp -ivn < ftppatron >patronlog 2>&1 &

and a second file called "ftppatron" which had the FTP commands in it:

open badmvs.library.usl.edu
user myusername mytopsecretpasswd
ascii
put patron.txt 'lbr.ftp.patron'
ls
bye

I haven't figured out how to do this with only one file, but this seems to work. I scheduled the job to be run and now the process is wholly automatic. But I still wish that I could do this with one file . . .
ccieToBe

2001-07-24, 5:32 pm

Thanks for posting that. I might modify those scripts for something I need to do soon. I need to get a FreeBSD box running Samba to do what an NT trust is doing now. Basically, the NT trust involves an NT server that I'm replacing copying a database file from another NT server residing in a portion of the company that I don't adminster. I think I'll setup cron to copy it each night through Samba or FTP. I know Samba can't do trust relationships (yet), but can it exist in 2 different domains?
Randy

2001-07-25, 6:50 am

Let me check up on this, I don't think you can have samba in two domains at once, but there may be a way to get around it. I'll let you know if I find anything.
ccieToBe

2001-07-29, 12:17 am

Thanks Randy. It seems like if Samba can't be in two domains at once I could run two sepperate Samba daemons.
ccieToBe

2001-08-01, 5:45 pm

In case anyone's interested, I was able to setup cron to accomplish this. What I did was leave smbd and nmbd alone and use smbclient (with a sepperate smb.conf file) to copy the 2 database files over every night. I pasted one of the cron statements below (the other one has the same format). The only thing I did out of ordinary in the new smb.conf file was tell Samba to act as a Windows 95 workstation so that I wouldn't have to add a new machine account to the source domain.

0 2 * * * /usr/local/bin/smbclient //source/sharename password -U username -s /usr/local/etc/domainnamesmb.conf -c 'get sourceDirectory/filename.mdb "/destination directory.mdb"'

This copies the database files from another department's server to my FreeBSD box at 2 AM everyday.
Sponsored Links





Free Braindumps | MCSE braindumps software forum

Copyright 2003 - 2008 examnotes.net