Forum Moderators: bakedjake

Message Too Old, No Replies

Need help with perl / cron

         

sdani

2:02 am on Feb 2, 2005 (gmt 0)

10+ Year Member



OK.. this is my first perl script.. this works from command line when I telnet my server (hosted at a host) and it ftpies a file to that server and zipps it. I used my ISP's admin interface to specify this pl file as cron job, but it did not run.. then I created an html file and loaded that html in browser, but it did not run.
<html>
<head></head>
<body>
<!--#include virtual="/cgi-bin/logftp.pl" -->
</body>
</html>

So.. I need help either in executing this perl script from browser (on event) or via cron job.. can someone help me.

my script:

perl -w
require Net::FTP;
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
$year=$year - 100;
$mon=$mon+1;
if($mon < 10)
{
$mon = "0" . $mon;
}
if($mday < 10)
{
$mday = "0" . $mday;
}
if($year < 10)
{
$year = "0" . $year;
}
$logfilenm = "ex"."$year$mon$mday".".log";
$trgt = "/usr/public_ftp/abcd/ftp/logs/".$logfilenm;
$ftp = Net::FTP->new("www.example.com");
$ftp->login("user","password");
$ftp->cwd("logs");
$ftp->get($logfilenm,$trgt);
$ftp->quit ;
$zip = "zip "."/usr/public_ftp/abcd/ftp/logs/".$logfilenm.".zip /usr/public_ftp/abcd/ftp/logs/".$logfilenm;
system($zip);

__END__

sdani

2:07 am on Feb 2, 2005 (gmt 0)

10+ Year Member



Just to update .. I just saw my email account and I received this message from cron deamon:

"require: not found
/usr/www/users/abcd/cgi-bin/logftp.pl: 3: Syntax error: word unexpected
"

From the admin menu of my ISP's control panel: i had specified following path for cron job:
/usr/www/users/abcd/cgi-bin/logftp.pl