Question
When I run the mailnotify script from a cron job I get the following error message
Can't locate setlib.cfg in @INC (@INC contains: /myuser/mylocal/twiki/bin /etc/perl /usr/local/lib/perl/5.8.4 /usr/local/share/perl/5.8.4 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at /home/myuser/mylocal/twiki/tools/mailnotify line 28.
BEGIN failed--compilation aborted at /home/myuser/mylocal/twiki/tools/mailnotify line 29.
I am wondering if there is a problem with permissions because i see the setlib.cfg file in the /twiki/bin/
Thanks
p.s. The
@INC
Library paths are listed as
/home/.alistar/myuser/mylocal/twiki/bin
. . .etc although in the general paths set for dreamhost the /.alistar is eliminated. I don't know if this is the problem, but there seems to be no way to change the
@INC
library paths.
Here is the cron job script I set up:
perl -I /myuser/mylocal/twiki/bin /home/myuser/mylocal/twiki/tools/mailnotify -q
Environment
--
XochipalaValdez - 24 Dec 2007
Answer
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
You might try the following. I'm on Linux, but here is what my cron job looks like. I sudo to apache so that everything in the server directory runs as the apache user because my cron jobs normally run as root. If you use the apache crontab this shouldn't be an issue.
The perl -I method should also work, but I've found it simpler to just cd to the bin directory first and then run the command directly in the tools directory.
#!/bin/sh
test -x /var/www/webhome/htdocs/tools/mailnotify || exit 0
cd /var/www/webhome/htdocs/bin
sudo -u apache ../tools/mailnotify -q
--
GeorgeClark - 09 Jan 2008
Thank you. I will try this. Although it seems as though the job begins to run and then gets the error message that it cannot locate a file. What does the test -x in the beginning of the script do?
--
XochipalaValdez - 18 Jan 2008
Ah... I could have left that off. It tests to see if the script exists. That way it avoids errors if the script is missing, and it is simple to disable a cron run by renaming the script within twiki without touching the cron jobs. I use the "cron.daily" directory instead of a custom crontab.
And the sudo could have been left out as well. I do that to run the notify under the web userid instead of root.
--
GeorgeClark - 19 Jan 2008
Just to give some feedback from the Windows side:
I ran into the same problem and solved it nearly the same way:
First I cd to TWiki's bin directory:
cd intranet\xampp\htdocs\twiki\bin
And then I run:
perl -I "c:\path\to\twiki\bin" ..\tools\mailnotify.pl
Works fine so far.
--
SebastianKlus - 04 Feb 2008
Hi, I have tried this latest one and still am getting this message.
Can't locate setlib.cfg in @INC (@INC contains: /user/www.website.org/twiki/bin /etc/perl /usr/local/lib/perl/5.8.4 /usr/local/share/perl/5.8.4 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at /home/use/tools/mailnotify line 28.
BEGIN failed--compilation aborted at /home/user/www.website.com/twiki/tools/mailnotify line 29.
I am still not sure what the
@INC
means.
--
XochipalaValdez - 12 Feb 2008
@INC is a list of directories where Perl is looking for its libraries, or in this case, the file
setlib.cfg which contains further directives.
From your error message it seems that you need to adjust your
-I parameter. Let me guess: You have something like
perl -I /user/www.website.org/twiki/bin ../tools/mailnotify
If so, simply fix like that:
perl -I /home/user/www.website.org/twiki/bin ../tools/mailnotify
The value after
-I should exactly show the directory where
setlib.cfg is in.
--
HaraldJoerg - 12 Feb 2008
Thank you, thank you everyone above. I was finally able to get my cron job to run.
--
XochipalaValdez - 12 Feb 2008
Fine

(I'm just setting to "answered")
--
HaraldJoerg - 12 Feb 2008
Doing same, but mail not triggered. Gives Can't locate setlib.cfg in
@INC
error.
--
Madhuri Yevale - 2013-06-10