Tags:
create new tag
view all tags

Question

I'm trying to configure cron to automatically execute the mailnotify script to send out emails and it's having some issues. I don't have Net::SMTP installed so I configured it to use sendmail instead, by setting the path to sendmail in the Twiki.cfg file:

$mailProgram = "/usr/sbin/sendmail -t -oi -oeq";

However, I get the following error when it tries to send an email - Can't exec "/usr/sbin/sendmail": No such file or directory at /home/seriouse/www/twiki/lib/TWiki/Net.pm line 202.

I've checked with my host and sendmail is located at /usr/sbin/sendmail, and it's working for vBulletin, so what am I doing wrong?

  • TWiki version: r1.8
  • Perl version: 5.006001
  • Web server & version: Apache 1.3.27
  • Server OS: Linux / Cpanel
  • Web browser & version: Mozilla 1.3
  • Client OS: WinXP

-- TWikiGuest - 04 May 2003

Answer

Depending on your ISP, you might have a different machine for telnet/ssh login and for Apache serving the web pages. That way you might have a program available on one machine but not an the other. Verify with your ISP, or debug. To debug you can do this before sendmail is executed in lib/TWiki/Net.pm:

    my $listSbin = `ls -la /usr/sbin/`;
    TWiki::writeDebug( $listSbin );

See the output in data/debug.txt. See also other TWikiDebugging tips.

-- PeterThoeny - 04 May 2003

Follow-up

Everything is on the same server. vBulletin is configured using the sendmail path, and is on the exact same server as the TWiki installation. What's even more odd is that registration emails are working just fine, but this isn't.

-- TWikiGuest - 04 May 2003

This is probably something to do with the cron environment being different from the Apache environment used by registration emails. Try running testenv from within the same cron job for a start. I suspect the userid for cron is different, or perhaps chrooted. You could also run the following simple shell script to check that sendmail exists and is executable by this user:

test -x /usr/sbin/sendmail && echo 'ok' || echo 'not ok'
echo foo | /usr/sbin/sendmail

If this says 'ok', then there is something very odd going on that is specific to the mailnotify script.

-- RichardDonkin - 05 May 2003


The following are the differences between the testenv script via the web and the testenv script via cron:

Web Cron
@INC library path: /home/seriouse/www/twiki/lib @INC library path: ../lib
OK, TWiki.pm found (TWiki version: 01 Feb 2003) Warning: 'TWiki.pm' not found - check path to twiki/lib.

And then other various errors...hope this helps in fixing it. Just a note, I get different output from the statistics script when it's run via cron as opposed to via SSH as well.

-- TWikiGuest - 04 May 2003

In the cron, try to cd first to the TWiki bin directory before you run the command:

(cd /path/to/twiki/bin; ./mailnotify 2>&1)

-- PeterThoeny - 06 May 2003

Ah, that worked. Thanks!

-- TWikiGuest - 07 May 2003

Edit | Attach | Watch | Print version | History: r7 < r6 < r5 < r4 < r3 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r7 - 2003-05-07 - TWikiGuest
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.