CommuniMail - Cron job problem

Message
Author
Bianca
Posts: 1
Joined: May 08, 2009 8:11 pm

Cron job problem

#1 Postby Bianca » May 08, 2009 8:16 pm

Hello,

I'm having a problem with cpanel cron job, I'm getting this error message:

Can't locate ./messages.cfg in @INC (@INC contains: /home/sergio/public_html/cgi-bin/communimail/clibs/CSV /home/sergio/public_html/cgi-bin/communimail/libs /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl/5.8.7 /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /home/sergio/public_html/cgi-bin/communimail/cmaild.pl line 14.

How can I fix this? I'm having a several problem with this script and I just installed it today!

Thanks a lot.

admin
Site Admin
Posts: 1839
Joined: Mar 22, 2006 12:32 pm

Re: Cron job problem

#2 Postby admin » May 11, 2009 7:10 am

Hello,

most likely you didnt included "cd /path/to/communimail" into your cron (as shown in install manual). What is your _exact_ cron command?

Thanks

Bianca wrote:Hello,

I'm having a problem with cpanel cron job, I'm getting this error message:

Can't locate ./messages.cfg in @INC (@INC contains: /home/sergio/public_html/cgi-bin/communimail/clibs/CSV /home/sergio/public_html/cgi-bin/communimail/libs /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl/5.8.7 /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /home/sergio/public_html/cgi-bin/communimail/cmaild.pl line 14.

How can I fix this? I'm having a several problem with this script and I just installed it today!

Thanks a lot.

madhosting
Posts: 8
Joined: Jun 30, 2009 8:51 pm

#3 Postby madhosting » Jun 30, 2009 9:00 pm

I have very similar errors.

Can't locate libraries.pm in @INC (@INC contains: /usr/lib/perl5/5.8.5/i386-linux-thread-multi /usr/lib/perl5/5.8.5 /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.2/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.1/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl/5.8.4 /usr/lib/perl5/site_perl/5.8.3 /usr/lib/perl5/site_perl/5.8.2 /usr/lib/perl5/site_perl/5.8.1 /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.2/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.1/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thr!
ead-multi /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl/5.8.4 /usr/lib/perl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl/5.8.2 /usr/lib/perl5/vendor_perl/5.8.1 /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .) at /home/sites/madnewsletters.com/public_html/madnewsletter/cmaild.pl line 5.
BEGIN failed--compilation aborted at /home/sites/madnewsletters.com/public_html/madnewsletter/cmaild.pl line 5.

The hosting I use has a front end for cron jobs that you just enter the full path to the file with the interpretor in front i.e. /usr/bin/perl /home/sites/madnewsletters.com/public_html/madnewsletter/cmaild.pl

I have tried to correct the errors by putting the full path the the required files in the script such as the absolute path to libraries.pm got rid of the first error and just failed with the next file that could not be found. by putting the full path infront of all the file calls I have got rid of all the errors above but I now cant get rid of the following error

Content-type: text/html

<HTML>
<HEAD>
<TITLE>Error !</TITLE>
</HEAD>
<BODY> <H1>Software error:</H1>
<CODE>Cannot open config file</CODE>
<P>
For help, please send mail to the webmaster (<a href="mailto:"></a>),
giving this error message
and the time and date of the error.

</BODY>
</HTML>

admin
Site Admin
Posts: 1839
Joined: Mar 22, 2006 12:32 pm

#4 Postby admin » Jul 01, 2009 10:55 am

You should just do a "cd" command and only then execute script.
If you will just provide full path to the script - that will bring you error that something is not found.

madhosting
Posts: 8
Joined: Jun 30, 2009 8:51 pm

#5 Postby madhosting » Jul 01, 2009 12:42 pm

Tried that, the error returned is then

Can't open perl script "cd": No such file or directory
/bin/sh: ./cmaild.pl: No such file or directory

admin
Site Admin
Posts: 1839
Joined: Mar 22, 2006 12:32 pm

#6 Postby admin » Jul 01, 2009 12:44 pm

madhosting wrote:Tried that, the error returned is then

Can't open perl script "cd": No such file or directory
/bin/sh: ./cmaild.pl: No such file or directory

What is your cron job command? Provide entire command string.

madhosting
Posts: 8
Joined: Jun 30, 2009 8:51 pm

#7 Postby madhosting » Jul 01, 2009 12:51 pm

The hosting I use has a "nice" front end to cron and so you don't add the command exactly as a normal cron commanrd.

The help information for the scheduled task setup is as follows

Scheduled tasks allows you to enable programs to run automatically on the server at specific intervals. Please note that each account can only run 3 scheduled tasks.

Configure Scheduled Tasks
The command lines below will be run on the web server for you at the intervals you select. Please note that the path is absolute so if your script is called test.pl and is located in your public_html/ directory then the full path would be:-

/home/sites/madnewsletters.com/public_html/test.pl.

Programs that use excessive server resources may be banned. We take this opportunity to remind you that we do not allow permanent server processes to be run on our servers.

Common Problems
Please note the following common problems you may experience when setting up a scheduled task:

•Please make sure you enter a valid date for your tasks.
•The file permissions for the script are set correctly, 711 or 755.
•If the scheduled program includes code from a scripting language, the path for the interpreter must be specified before the script. For example, /usr/bin/perl (Perl), /usr/bin/php (PHP 4) or /usr/bin/php5 (PHP 5)
•If the script being run is adapted from a CGI script, ensure the first line of the script is a 'shebang' line containing the correct interpreter path - as above - (for example #!/usr/bin/perl).

The command I entered originally that caused the error where files could not be found is

/usr/bin/perl /home/sites/madnewsletters.com/public_html/madnewsletter/cmaild.pl

The second command that caused the error Can't open perl script "cd": No such file or directory /bin/sh: ./cmaild.pl: No such file or directory
is

/usr/bin/perl cd /home/sites/madnewsletters.com/public_html/madnewsletter; ./cmaild.pl

There are then seperate drop down boxes to set how often the command runs.

Thanks
Richard

admin
Site Admin
Posts: 1839
Joined: Mar 22, 2006 12:32 pm

#8 Postby admin » Jul 01, 2009 12:54 pm

As per manual, line should be:

cd /home/sites/madnewsletters.com/public_html/madnewsletter; perl cmaild.pl


assuming that path /home/sites/madnewsletters.com/public_html/madnewsletter is correct and cmaild.pl located there.

madhosting
Posts: 8
Joined: Jun 30, 2009 8:51 pm

#9 Postby madhosting » Jul 01, 2009 3:39 pm

That gives the following error

nice: cd: No such file or directory
Can't open perl script "cmaild.pl": No such file or directory

admin
Site Admin
Posts: 1839
Joined: Mar 22, 2006 12:32 pm

#10 Postby admin » Jul 02, 2009 5:35 am

madhosting wrote:That gives the following error

nice: cd: No such file or directory
Can't open perl script "cmaild.pl": No such file or directory
Then, path you provided is not correct.

madhosting
Posts: 8
Joined: Jun 30, 2009 8:51 pm

#11 Postby madhosting » Jul 02, 2009 9:46 am

The path is correct and the command
/usr/bin/perl /home/sites/madnewsletters.com/public_html/madnewsletter/cmaild.pl
finds cmaild.pl but then can't find libraries.pm as per the original error

admin
Site Admin
Posts: 1839
Joined: Mar 22, 2006 12:32 pm

#12 Postby admin » Jul 02, 2009 9:50 am

This is very strange:
cd: No such file or directory
Try to put single line to cron in order to test:

cd /home/sites/madnewsletters.com/public_html/madnewsletter/



Actually, problem that it cant find libraries.pm because it didnt completed "cd" into that dir.

madhosting
Posts: 8
Joined: Jun 30, 2009 8:51 pm

#13 Postby madhosting » Jul 02, 2009 10:05 am

that gives the following error

nice: cd: No such file or directory

So it is not accepting cd: as a valid command to change the directory, is it looking for a dirrectory or file called cd?

madhosting
Posts: 8
Joined: Jun 30, 2009 8:51 pm

#14 Postby madhosting » Jul 02, 2009 10:20 am

accoring to my hosting support CD cannot be used.

Quote from support:-
"It simply means that the script isn't able to access those files through relative links, please change them all to full addresses to the files, and it should work fine then hopefully.

I have no problem modifying the files to put the full paths in but I might need some help working out where all the file calls are that I will need to modify

admin
Site Admin
Posts: 1839
Joined: Mar 22, 2006 12:32 pm

#15 Postby admin » Jul 02, 2009 10:39 am

in cmaild.pl add following lines right after "use strict;" line:

use lib '/home/sites/madnewsletters.com/public_html/madnewsletter';
chdir('/home/sites/madnewsletters.com/public_html/madnewsletter');