Hi,
I just installed 10.3 and am trying to get a cron job to fire off a perl script which will send an email saying the cron job was completed.
crontab listing
* * * * * /Users/blah/Library/Scripts/test.pl
Here is the script:
test.pl ------------------------------------------------ #!/usr/bin/perl -w
use strict;
my $from = '[EMAIL PROTECTED]'; my $to = '[EMAIL PROTECTED]'; my $body = "Success.";
open (SENDMAIL, "| mail -t");
Check that open succeeded, and use a full path to 'mail', especially since under cron your PATH may be different/restricted.
open (SENDMAIL, "| /usr/bin/mail -t") or die "Can't pipe to sendmail: $!";
Having said that, I would suggest not using mail directly at all, instead install a mail handling Perl mod from CPAN, there are lots of them.
print SENDMAIL "Subject: Backup Email Test\n"; print SENDMAIL "From: $from\n"; print SENDMAIL "To: $to\n\n"; print SENDMAIL $body; close (SENDMAIL);
exit; --------------------------------------------------
I have enabled Postfix to be running and have sent and received an email from the command line. I've also executed the script run from the command line. But the script doesn't seem to be sending an email. Do I need to get perl set to run in a settings file? I thought that I only needed to mess with settings files if I was going to use the web server. A little help would be appreciated.
HTH,
http://danconia.org