laziness, impatience, and hubris | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Is it possible? Most certainly -- everything you asked about is possible and in most cases, rather easy. I recommend reading up on the following modules (most of which can probably be installed using the "ppm" command if you're using ActiveState perl as I suspect you are, or using the cpan shell if you're on a unix system ("perl -MCPAN -e shell"). To send email, I prefer the MIME::Lite module which makes it nice and easy (including sending attachments). Here's some sample code that illustrates using MIME::Lite to send a log file as a message body (this is ripped from some code I use) and sends it.
You're on the right track using Net::FTP for FTP access. Here's some sample code that gets a remote file: Read the Net::FTP documentation for more detail. For problem 2, you could also use Net::FTP to push the file to the servers (assuming they have FTP servers installed and running). One approach would be to use a script to push (via FTP) the files to the servers. Have another script that runs on the servers on a scheduled basis and when it sees new files in your incoming directory, it unzips them and processes them. See Archive::Zip for dealing with .ZIP files as well as IO::Zlib for dealing with .gz files. As for scheduling things on NT, you can use the "at" command or try the task scheduler. Or if you're running Windows 2000, you can use the Scheduled Tasks service via the Control Panel. To schedule a perl script, I usually use the full path the perl program and the script name as the command for task to run to make sure everything finds the right path. For example, to schedule the task "foo.pl" to run, I set the command to run (in the Task Scheduler or Scheduled Tasks setup) to be something like "c:\Perl\bin\perl.exe c:\foo\foo.pl") You might also like to read Dave Roth's "Win32 Perl Scripting: The Administrator's Handbook" for more details about how to use Perl to do admin tasks on Windows. In reply to (RhetTbull) Re: Seeking tutelage
by RhetTbull
|
|