LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 08-07-2007, 11:02 AM   #1
TheDude05
Member
 
Registered: Jan 2005
Distribution: Debian, Ubuntu, RHEL
Posts: 36

Rep: Reputation: 15
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
 
Old 08-08-2007, 08:19 PM   #2
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,289

Rep: Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034
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.

Last edited by chrism01; 08-08-2007 at 08:20 PM.
 
Old 08-09-2007, 05:42 PM   #3
TheDude05
Member
 
Registered: Jan 2005
Distribution: Debian, Ubuntu, RHEL
Posts: 36

Original Poster
Rep: Reputation: 15
Wow, that was easy. And yes when I checked I had some 700 messages from cron. :P

Thanks!
 
Old 08-09-2007, 07:13 PM   #4
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,289

Rep: Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034
glad to help.
 
  


Reply

Tags
cron, postfix


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cron job Thulemanden Linux - General 1 11-06-2006 11:40 AM
Cron Job newbie_adm Linux - Newbie 2 06-05-2006 11:52 PM
need help with cron job parthcorp1 Linux - General 2 02-01-2005 11:37 AM
cron job sanjith11 Linux - General 5 07-14-2004 01:06 PM
Cron Job imanahmadi Linux - Newbie 1 07-03-2003 11:39 PM


All times are GMT -5. The time now is 11:35 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration