On Fri, 22 Aug 2008, Raymond Jette wrote:


Good morning,

The following is in my main.cf file:

Relay_recipient_maps = hash:/etc/postfix/relay_recipients,
                Hash:/etc/postfix/relay_recipients_oldmailsystem

This is working good. The problem I am having is using a cron job to schedule a 
rebuild of the relay_recipients. This list contains my Exchange users. I
have following the documentation on Postfix?s site with no luck.

I have a file called update_relay_recipients.sh. This file contains the 
following:

#!/bin/sh
cd /etc/postfix ; ./getadsmtp.pl && postmap relay_recipients

This work if I run it by itself.

I have the following setup by running sudo crontab ?e

1,30 * * * *         cd /etc/postfix ; ./update_relay_recipients.sh

This job runs but never works. The relay_recipients file gets updated but the 
postmap command is never run.

Following are my cron.log file entry for this job:

Aug 22 11:30:01 mx1 /USR/SBIN/CRON[9722]: (root) CMD (cd /etc/postfix ; 
./update_relay_recipients.sh)

Any ideas what could be going on? Thanks in advance for any help you may 
provide.

It would be my guess your crontab can not find 'postmap' because it isn't in environment's PATH. On FreeBSD, 'man 5 crontab' shows PATH is set to /usr/bin and /bin. In FreeBSD, postmap lives in /usr/local/sbin if installed via the ports tree. Therefore, the script would not be able to find 'postmap'. However, if I were to add to the top of the crontab:

PATH=/usr/bin:/bin:/usr/local/sbin

the script would be able to find 'postmap'.

Otherwise, in your script, if you use an absolute path to where 'postmap' lives, it should work.

-d

Reply via email to