Problem with postalias and cron

This is a discussion on Problem with postalias and cron within the alt.comp.mail.postfix forums, part of the Mail Servers and Related category; Hi, I have a problem running postalias by a cron job. I use the following line: 20 0 * * * postalias /services/...


Go Back   Usenet Forums > Mail Servers and Related > alt.comp.mail.postfix

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-02-2008
Thomas Anders
 
Posts: n/a
Default Problem with postalias and cron

Hi,
I have a problem running postalias by a cron job. I use the following
line:

20 0 * * * postalias /services/spammail

Where spammail is a file with the anti-spam email-adresses generated
daily. My problem is, that the command has no effect. When I set

20 0 * * * touch /test.txt

instead, I have a file test.txt the next morning, so I think cron is
working correctly.

Is any problem running postalias from cron known?

Thanks,
Thomas
Reply With Quote
  #2 (permalink)  
Old 03-02-2008
Martin Smith
 
Posts: n/a
Default Re: Problem with postalias and cron

Thomas Anders wrote:
> Hi,
> I have a problem running postalias by a cron job. I use the following
> line:
>
> 20 0 * * * postalias /services/spammail
>
> Where spammail is a file with the anti-spam email-adresses generated
> daily. My problem is, that the command has no effect. When I set
>
> 20 0 * * * touch /test.txt
>
> instead, I have a file test.txt the next morning, so I think cron is
> working correctly.
>
> Is any problem running postalias from cron known?


you probably need to put the full path to postalias in, or declare
a path such as
PATH=/bin;/usr/bin;/usr/local/bin;....etc etc at the top of the crontab
as the default path of root crontabs is quite limited

--
Martin
Reply With Quote
  #3 (permalink)  
Old 03-03-2008
Martin Gregorie
 
Posts: n/a
Default Re: Problem with postalias and cron

Thomas Anders wrote:
> Hi,
> I have a problem running postalias by a cron job. I use the following
> line:
>
> 20 0 * * * postalias /services/spammail
>
> Where spammail is a file with the anti-spam email-adresses generated
> daily. My problem is, that the command has no effect. When I set
>
> 20 0 * * * touch /test.txt
>
> instead, I have a file test.txt the next morning, so I think cron is
> working correctly.
>
> Is any problem running postalias from cron known?
>

If a command writes anything to stdout or stderr (and this usually
happens if it fails) that should be mailed to root. Have you checked in
root's mailbox?

Another useful (though not foolproof) test is to become the relevant
crond user, cd into the directory where the cron job is kept and run it
manually. Usually this will smoke out quite a bit of cruft, such as not
using absolute names for programs & scripts. From the example you give
this is your problem: touch is in /bin while postalias is in /usr/sbin
which, IIRC, isn't in the default PATH for root, crond runs as root on
my system.


HTH

--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:06 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0