Monday, May 08, 2006

PB's contrib - making processqueue cron work

Did the following to set the cron to work for phplist processqueue...

To check the error messages in cron piped the message to log.txt
31 17 * * * /home/apachemails/phplist -pprocessqueue > log.txt

Got the following message:
[apachemails@krishna ~]$ cat log.txt
PHPlist version 2.10.2 (c) 2000-2006 Tincan Ltd,

Error: USER environment variable is not defined, cannot do access check.
Please make sure USER is defined.

>From google got the following solution:

This happens because when a crontab executes, the *$USER* variable is not
set. We must set it in our script. So open up the phplist file and add the
export USER

The entire file should now look like this:
export CONFIG

export USER

/path/to/php /home/yourusername/path/to/phplist/admin/index.php $*

Note that you also must set the *$commandline_users* variable in your *
$commandline_users = array("yourusername");

With all of that in place, you can automate your queue and bounce processing
with a crontab like this (adjust your paths accordingly):
# Suppress crontab emails

# Process phplist queue daily, every half hour
0,30 * * * * /home/yourusername/phplist -pprocessqueue

# Process phplist bounces once a day, 5am
0 5 * * * /home/yourusername/phplist -pprocessbounces
In our case:
export USER

now the cron works fine :)

No comments:

Post a Comment