Page 6 of 8

Documentation on cron jobs and commandline script

PostPosted: 5:09am, Sat 21 Oct, 2006
by H2B2
I've just added a few pages to the documentation wiki you might consult when setting up a commandline script and/or cron job:

- Using a commandline script
- Setting up cron jobs

PostPosted: 1:38am, Sat 27 Jan, 2007
by Julianna
Hi.

I have tried the different options in this post and several of the ones in referenced posts. The closest I can get is either the html output others have gotten or a report saying "You ([CPanel username]) do not have sufficient permissions to run phplist on commandline"

Any insights?

Thanks.

Re: success on 2.9.4 - need to set USER environment variable

PostPosted: 1:16pm, Sat 27 Jan, 2007
by Julianna
I finally got it to work for me!

For reference, I am using CPanel and this is what I did:

1. Rename the /bin/phplist file to /bin/phplist.txt (CPanel doens't like running files without an extension).
2. Update the /bin/phplist.txt file to reference the paths for my server.
3. Upload the updated phplist.txt file to the /bin folder
4. Added the following code to my config.php file, and used my CPanel username as one of the comandline users (i.e. replaced what was in the quotes with the actual CPanel username).
Code: Select all
$commandline_users = array("cpanel username");

5. Upload the updated config.php file
6. Log into the CPanel interface and created a cron tab (in the Standard editor, so I could more easily select timing) with the following in the command to run:
Code: Select all
/path/to/bin/phplist.txt -p processqueue



Here is the original post I used to get this working:
Cafamily wrote:I got cron jobs to work on 2.9.4 so i thouht I'd report what I did and make a couple of comments on the original post by Daniela (which was helpful)...

1. why create a script called "phplist" if you're not going to use it? The cronjob line given runs the /lists/admin/index.php directly so the phplist file is superfluous unless you use that ( as I have ).

2. with 2.9.4 a MAILQUEUE_THROTTLE variable exists in the config file so I used that, my settings are :

Code: Select all
define("MAILQUEUE_BATCH_SIZE",200);
define("MAILQUEUE_BATCH_PERIOD",3600);
define('MAILQUEUE_THROTTLE',5);


this will send a message every 5 seconds, batching no more than 200 message per hour. This is fine for us as we have 800+ subscribers and two lists.

3. with 2.9.4 (at least) a phplist file is included in the download - it's under the bin directory. I relocated this to a location away from my public html files ( say /usr/local/cron_scripts ) and point to this in my cronjob line:

Code: Select all
# every hour at 15 minutes past we process the queued messages
15 * * * * /usr/local/scripts/phplist -p processqueue


I then edited the phplist file to reflect the locations of my config.php and admin/index.php file.

3. I found no need to include any login or password variables in the call to the admin/index.php file. The problem for me was that a cronjob does not have a USER environment variable set and it is from this that the admin/index.php file checks against commandline_users.

The solution was to create a pseudo (non existent) user in the commandline_users variable in the config.php file. so ...

Code: Select all
$commandline_users = array("listprocessor","any other","users,"you want","to set");


I then inserted the following in my phplist file which would set the USER environment varibale (if it wasn't already set)

Code: Select all
# Check the USER variable is set
if [$USER]; then
   echo found USER variable
else
   USER=listprocessor
   export USER
fi

this went just below the line
Code: Select all
export CONFIG


finally make sure the phplist file is executable (chmod 755)

That did it for me - hope it helps

Re: How to make PHPlist work with Cron Jobs

PostPosted: 1:33pm, Wed 31 Jan, 2007
by dani190
FROM Daniela's first post....

i try this and i get a list of errors but cant post them here. it just outputs like

Code: Select all
X-Powered-By: PHP/4.4.4
Set-Cookie: PHPSESSID=dd64053669ad70b2ed79fa2dfec6681b; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-type: text/html


i cant post any more forums wont let me post links

but that goes on even longer maybe you are familiar with it?

every single cron job i try gives that error or message out to me, and my messages in the queue stay there.

Totally Out Of Idea

PostPosted: 3:48am, Fri 11 May, 2007
by t3nooq
hi. i'm a new super newbie to phpList. currently i've followed Daniela's instruction on the 1st page but nothing happens. i'm currently need to send one news to about 500-600 my client emails every month. the news should be in html format and it should be from my company news web page (one page). can i send the page link so it will view as html page in my client email. can anyone help me? -thanks- :?:

PostPosted: 2:14pm, Wed 01 Aug, 2007
by H2B2

still this error in mail

PostPosted: 11:28am, Thu 02 Aug, 2007
by vincentnjara
I have configured cron for processqueue as mentioned above, still I receive error below through mail.


Some errors occurred in the PHPlist Mailinglist System
URL:
Error message(s):

Error: You do not have enough privileges to access this page

==== debugging information

SERVER Vars
SHELL=
USER=xyz
PATH=
PWD=
SHLVL=1
HOME
LOGNAME=xyz
_=PHP_SELF=
argv=Array
argc=4

thanks in advance for any help

Re: still this error in mail

PostPosted: 7:31pm, Thu 02 Aug, 2007
by H2B2
vincentnjara wrote:Error: You do not have enough privileges to access this page

Possibly related to these posts:
viewtopic.php?p=31844#31844
viewtopic.php?p=16680#16680
viewtopic.php?p=21037#21037

Some errors occurred in the PHPlist Mailinglist System

PostPosted: 3:42am, Fri 10 Aug, 2007
by vincentnjara
I have configured cron for processqueue as mentioned above, still I receive error below through mail.


Some errors occurred in the PHPlist Mailinglist System
URL:
Error message(s):

Error: You do not have enough privileges to access this page

==== debugging information

SERVER Vars
SHELL=
USER=xyz
PATH=
PWD=
SHLVL=1
HOME
LOGNAME=xyz
_=PHP_SELF=
argv=Array
argc=4

thanks in advance for any help

I have found out a solution for this error.

1) Go to database table ‘phplist_task’ and get the id of the row for processqueue.
2) Then in table ‘phplist_admin_task’ search for the row that has admin user Id (Id of user who suppose to access the processqueue through cron) and the Id mentioned in the step 1.
3) If such a row exists then edit the value of ‘level’ column to 1(if the value is 0).
4) If such a row do not exists the create a new row with a admin user Id (Id of user who suppose to access the processqueue through cron) and the Id mentioned in the step 1 and the ‘level’ column value as 1.

Hope this information will be usefull to All
Vincent
[/code]

After much trials and tribulations...

PostPosted: 10:12pm, Thu 16 Aug, 2007
by chibiaida
Newbie here...

After spending the entire day trying to set up Cron on Bluehost, I got a Cron Daemon email after a run that says:

Code: Select all
PHPlist version 2.10.4 (c) 2000-2007 Tincan Ltd, http://www.phplist.com
Usage: /home/chibiswitch/public_html/phplist/admin/index.php -p page  [other parameters]


Does that mean that it ran successfully?? How can one tell that the cron job was completed??

PostPosted: 8:41am, Mon 20 Aug, 2007
by knonymouse
I monitor the cron job by having my own email address at the top of the users list and also at the bottom (so I should know when the first and last messages are sent through the email stream.)

Also tell the server to make the cron verbose and send an email to you notifying you each time it triggers.

Just yesterday, everything that phplist reported and the cron reported looked just fine... except no emails received. When I send a test message, it wasn't received. Some problem at the server I suppose. Fortunately, back to normal now. Go figure.

PostPosted: 5:21pm, Mon 24 Dec, 2007
by santos.john
staticfiends wrote:now it gives me this sent to me: :shock:

Code: Select all
Content-type: text/html
X-Powered-By: PHP/4.3.10
Set-Cookie: PHPSESSID=b5f14d33e1a5c188f1fed91fb37e5baf; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache


hat is weird is i can put the command in and it will run. but once I put it in a cron job it doesnt run. I do have cron capabilities

this is my cron job anything wrong with it? Thx

PostPosted: 7:05pm, Mon 24 Dec, 2007
by WinstonN
halo,

try this cron setup,
viewtopic.php?t=13713

cheers,
wins

UN and Password

PostPosted: 1:29pm, Sun 24 Feb, 2008
by manfredk
Hi
Have not got the Cron job working YET (coming back with Permission denied.
In the Example given (Daniela) which Username and Password is meant? Is the the one to access the Domain Control Panel or the Mysql Password or the List Admin Login Password?
Have tried a couple of combinations so far but still Cron Job Report back of / Permission Denied.
do any of the files need to be maybe set to 755 or 777
Much Appreciated

cron job processqueue (CGI not CLI, on shared host)

PostPosted: 3:20pm, Sat 19 Apr, 2008
by wspademan
On my shared-host site, with cpanel, the phplist script does not work (because BASH is not installed). Also the server does not have the CLI version of PHP5, so I was getting HTML output from the cron job. Here's what finally worked (using phplist version 2.10.5):

Well, I spent two hours composing a solution that I think would help many people on this subject, but the system won't accept it (it thinks I am spamming). Contact me if you want my solution. I had to edit index.php in admin AND create the cron job properly.