Rather than using crontab, which is pretty much a pull method, why not use a perl daemon process - to use push?
my $error=0; while ($error <1) { sleep 5; #or more just make sure you have a sleep in there #&readdir #&ftp files #&delete files #if (some error) { $error=1; } } If you use crontab, you could be in danger of having multiple processes starting up to ftp the same files. This would happen if your time frequency was too small, and you a) had a large number of files to process b) your system was under a high load and processes are completing slowly. c) your destination machine has issues (of the non psychiatrist type) and you timeout a lot. You can of course use a lockfile, simply write the pid ($$) to a file and then whenever your script starts, read that file, get the pid, then issue if (kill 1 $pid) { #Process is alive die "Another process is still running"; } Regards Marty p.s. Net::FTP is the file you want. You will have to make provisions to cope with Passive or non-passive ftp transfers. ----- Original Message ----- From: "James Schappet" <[EMAIL PROTECTED]> To: "'Craig Sharp'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, June 09, 2003 3:59 PM Subject: RE: [Perl-unix-users] URGENT: Scan a directory and ftp if there are files > Now with sample code in-hand. Don't use FTP. > > FTP is insecure and should not be used. > > Take a look at using SSH/SCP. > > There are perl modules for SCP, but I think that would be over kill a > simple shell or perl script would do. > > Jimmy > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Craig Sharp > Sent: Monday, June 09, 2003 10:34 AM > To: [EMAIL PROTECTED] > Subject: [Perl-unix-users] URGENT: Scan a directory and ftp if there are > files > > Hi all, > > I need a example of scanning a directory on a scheduled basis (crontab) > for files. If there are files in the directory, those files need to be > ftp'ed to a server and then deleted from the sending server. This is an > automated incoming mailbox for EDI and the data needs to be transfered > when it arrives. > > This is a hot task so any help would be appreciated. > > Thanks! > > Craig A. Sharp > Unix Systems Administrator > DNS Administrator > Security Administrator > Roush Industries > Office: 734-466-6286 > Cell: 734-231-6769 > Fax: 734-466-6939 > [EMAIL PROTECTED] > ==================================================== > I have not lost my mind, it's backed up on tape somewhere! > ==================================================== > _______________________________________________ > Perl-Unix-Users mailing list > [EMAIL PROTECTED] > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > > _______________________________________________ > Perl-Unix-Users mailing list > [EMAIL PROTECTED] > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > _______________________________________________ Perl-Unix-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs