LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Cron job and postmap issues (https://www.linuxquestions.org/questions/linux-server-73/cron-job-and-postmap-issues-575366/)

TheDude05 08-07-2007 11:02 AM

Cron job and postmap issues
 
I wrote a python script that runs through our Active Directory to get a list of email addresses to use for postfix's relay recipients map. My python script works correctly, however my cron job is not. To be exact, postmap will not run. Heres the script I'm using for my cron job.

Code:

#!/bin/sh

python /opt/postfix_cah/postfix_relay.py > /dev/null 2>&1
cd /etc/postfix
postmap relay_recipients

And my crontab

Code:

# Synchronize relay recipients from Active Directory
*/10 * * * *    /opt/postfix_cah/relay.sh

I added that as root with "crontab -e". Heres the thing, if I run the script manually the postmap part will work which leads me to believe its some sort of permission issue. Any help

chrism01 08-08-2007 08:19 PM

cron has a minimal default env. Always specify full path to all progs, or cd into dir and then do ./myprog .
Incidentally, cron usually emails the job owner if it has a prob, so you've prob got an email in root saying 'postmap: file or dir not found' or words to that effect.

TheDude05 08-09-2007 05:42 PM

Wow, that was easy. And yes when I checked I had some 700 messages from cron. :P

Thanks!

chrism01 08-09-2007 07:13 PM

glad to help.
:)


All times are GMT -5. The time now is 04:20 AM.