The cron job executes a .cgi script in wich there is the code above.
The script executes some tasks and prints a report each time it is called.
It doesn't send email autonomously:cron sends me an e-mail with the script output,that is probably intended for browsers.
Probably I need to add in that script a suitable e-mailing routine, but I don't know how to proceed...
For your convenience here is the whole script:
$password = 'blah';
full URL of script.cgi
$admin_url_base = 'http://www.blahblah.net/script.cgi';
# minimum number of pages you want to create each day.
$minpages = 1;
# maximum number of pages you want to create each day.
$maxpages = 6;
# path to the script (needed for cronning)
# because the default probably won't work.
$fullpath = '/home/user/public_html/';
##### Script begins #####
use CGI::Carp qw (fatalsToBrowser);
use HTTP::Request::Common qw(POST);
$ua = LWP::UserAgent->new;
$keywords = 'pages.txt';
$klist = '';
$admin_url = $admin_url_base . '?createpages';
# open source file to read
open (KEYS, "<$fullpath$pages");
@kd = <KEYS>;
# creates the random algo
$range = $maxpages - $minpages;
$random_number = int(rand($range)) + $minpages;
# formats the arrays
$klist .= shift(@kd);
@completed = split(/\n/,$klist);
# opens source file to overwrite current status
open (KEYS, ">$fullpath$pages");
print KEYS @kd;
# uploads pages in the form
$req = (POST $admin_url,
'pass' => $password,
'checkdata' => '1',
'pagenames' => $klist
$response = $ua->request($req);
# prints report
print "Content-type: text/html; charset=iso-8859-1\n\n";
print "<p><font face=Arial Black size=4><b>mail test</b></font></p>\n";
print "<p><font face=Verdana><b>Your report</b></font></p>\n";
print "<p><b><font face=Verdana size=2>Today the following new pages have been created successfully:</font></b></p>\n";
print "<p><font face=Verdana size=2>$_.htm</font></p>\n";