[how to] make phplist work with Cron Jobs

Solutions for other advanced phplisters

Solution worked?

Yes
17
30%
No
14
25%
Still working on it
26
46%
 
Total votes : 57

Confused about batch period

Postby rheems » 4:55pm, Sun 27 Nov, 2005

" # define the length of one batch processing period, in seconds (3600 is an hour)
define("MAILQUEUE_BATCH_PERIOD",60);
# Throttle sending messages; indicates the number of milliseconds to pause
# between each message (millisecond is one-millionth of a second)
define("MAILQUEUE_PROCESSING_THROTTLE",2000000); "


Thanks for the great post many months ago. Hopefully someone is still listening to this thread. My question is why the MAILQUEUE_BATCH_PERIOD set to 60 if the batch is off? WHat does this make the script do? If the throttle is set to 2 seconds, will that send 1800 per hour or 30 per minute- Either way, wouldn't it send 1800 messages per hour? My host only allows 600 per hour, so I want to be sure to not get suspended again.

Thanks.
rheems
phpList newbie
 
Posts: 1
Joined: 4:34pm, Sun 27 Nov, 2005

Re: How to make PHPlist work with Cron Jobs

Postby kaon » 8:14am, Fri 23 Dec, 2005

Daniela wrote:...

Now we have to create a file called "phplist" (without the quotes please) in the same directory as the phplist installation.
The file should contain the follwing code

#!/bin/bash
...
# run the PHPlist index file with all parameters passed to this script
/usr/bin/php /home/water/public_html/fountain/admin/index.php $*


Copy and paste it as it is, but remember to replace the domain, directory, user, password, etc. Double check there are no spaces or enter after the last character.

...

Now lets go to cron jobs.
You just have to sent this up once, the day and hour you want the queue to start to be processed.
The command should look like this
php /home/water/public_html/fountain/admin/index.php page=processqueue login=fish password=seashell


huh? I'm confused...

You create the bash script that calls the php interpreter to execute the index.php.
But the cron job you specify doesn't seem to use the bash script.

So what was the bash script for?
kaon
PL Nut
 
Posts: 36
Joined: 7:18am, Fri 23 Dec, 2005

Mailer Error: Could not instantiate mail function.

Postby k6dyc » 3:58pm, Fri 13 Jan, 2006

With all the help in this and other threads I have come up with a CGI command line that seems to actually call processqueue:
Code: Select all
\php\php "\program files\apache group\apache2\htdocs\weather\lists\admin\index.php" page=processqueue login=yyyyy password=xxxx

My eventlog shows that it tried to processqueue, but it gives the error:
Code: Select all
processqueue 2006-01-13 08:43:36 Mailer Error: Could not instantiate mail function.

I'm fighting two issues here, first I have to run on Windows which always has a few strange things to deal with, like quotes around the pathname if it has spaces in it. The second is just getting the cron to work with Windows. I have the PHP CGI version, and the command listed above seems to work, but with the error indicated. Any ideas?
k6dyc
phpLister
 
Posts: 5
Joined: 6:19pm, Thu 05 Jan, 2006

HELPPPP

Postby TarekEmam » 2:37pm, Wed 01 Feb, 2006

i am getting this error now and i followed all the steps

can anyone help please

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=/bin/sh
MAILTO=million
PATH=/usr/bin:/bin
PWD=/home/million
SHLVL=1
HOME=/home/million
LOGNAME=million
_=/usr/bin/php
PHP_SELF=
argv=Array
argc=4
TarekEmam
phpList newbie
 
Posts: 1
Joined: 2:36pm, Wed 01 Feb, 2006

Cron Job using usr/bin/curl

Postby MaxPotential » 8:10pm, Fri 17 Feb, 2006

My web host allows cron jobs using usr/bin/curl. I setup my cron job as follows 'usr/bin/curl http://mydomain.com/phplist/admin/index ... ocessqueue > /dev/null'. The cron job runs but it does not process the processqueue. Does anyone have any ideas?
MaxPotential
phpList newbie
 
Posts: 1
Joined: 7:59pm, Fri 17 Feb, 2006

Postby marksu » 5:32pm, Tue 28 Feb, 2006

Running wget http://...i/admin/index.php?page=proces ... assword=...

Cant see it anything had actually been sent?
Seems like the processques is not run?
Leads to two processes.
Should it show 2 separate "Done" lines?

[1]- Done wget http://www.example.com/admin/index.php?page=processqueue
[2]+ Done login=myloginname
marksu
PL Geek
 
Posts: 110
Joined: 10:57pm, Sun 13 Feb, 2005

Kinda freakin' out - What version are we talking about?

Postby michaelchristopher » 4:26pm, Fri 03 Mar, 2006

I'm totally lost now in the cron thing. Some topics seem to say that x works in 2.8 but not in other versions... some topics seem to start in the middle of the whole process assuming that everybody knows what's going on. Diff between batch and cron? argh.

Could someone who knows how to get cron working under the following conditions give us a hit back? Thanks!

PHPlist v 2.10.2
Shared hosting with no shell/command line access
Cpanel cron capability

Love PHPlist, been using it for a year, mailing list growing, losing my mind over the processqueue limitations, and can't sort out the cron posts... :cry:
michaelchristopher
phpLister
 
Posts: 13
Joined: 3:15pm, Fri 16 Sep, 2005
Location: Tulsa, Oklahoma, USA

Postby zeuschicago » 12:33am, Mon 06 Mar, 2006

AHhhhhhhhhhhhhhhhhhhhhhh! Got it

When I was logging into the shell, and test, the php version was the CLI version. However, when running the CRON job from Cpanel, and just specificy PHP, Cpanel has the CGI version in the path first :lol:

so instead of /user/bin/php or just php (cgi interface), I switched to /usr/local/bin/php (cli interface) and used the following cron job from Cpanel

USER=dpage; export USER; /usr/local/bin/php /home/dpage/public_html/phplist/admin/index.php -p processqueue > /tmp/crontest


Anyone getting that HTML crap in the output when running the cron job from Cpanel its because its using the CGI version. Setting the path the correct PHP (cli) interface did the trick....after many many days of troubleshooting!

Zeus
zeuschicago
phpLister
 
Posts: 8
Joined: 7:18pm, Fri 27 Jan, 2006

Postby jameso » 5:04am, Mon 06 Mar, 2006

zeuschicago wrote:Anyone getting that HTML crap in the output when running the cron job from Cpanel its because its using the CGI version. Setting the path the correct PHP (cli) interface did the trick....after many many days of troubleshooting!

Zeus

Thanks for the advice - I have changed my cron job command and will test it out when the cron job is next scheduled to run.

Cheers!
jameso
phpLister
 
Posts: 11
Joined: 5:47am, Wed 08 Feb, 2006

very confused by original post

Postby jackinTO » 8:01pm, Fri 10 Mar, 2006

and add the following line after it:
# Throttle sending messages; indicates the number of milliseconds to pause
# between each message (millisecond is one-millionth of a second)
define("MAILQUEUE_PROCESSING_THROTTLE",2000000);

This means is going to send an e-mail every 2 secconds.


last time i checked, millisecond is 1-thousandth of a second and microsecond is 1-millionth.

so for the above example, is the code correct, or is the instruction correct?

in other words
does the command in original post work in milliseconds (in which case i should change the number to 2000, or does it really work in microseconds, in which case the above code is correct?

not trying to be a pain, really. i'm very new to this and have already been fined by my isp for overloading the server, so i've got to figure out a way to slow it down.[/quote]
jackinTO
PL Nut
 
Posts: 18
Joined: 7:45pm, Fri 10 Mar, 2006
Location: toronto CANADA

never mind

Postby jackinTO » 3:34am, Sat 11 Mar, 2006

i got it working without using that part.
jackinTO
PL Nut
 
Posts: 18
Joined: 7:45pm, Fri 10 Mar, 2006
Location: toronto CANADA

Re: HELPPPP

Postby simspeed » 3:50pm, Wed 15 Mar, 2006

TarekEmam wrote:i am getting this error now and i followed all the steps

can anyone help please

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=/bin/sh
MAILTO=million
PATH=/usr/bin:/bin
PWD=/home/million
SHLVL=1
HOME=/home/million
LOGNAME=million
_=/usr/bin/php
PHP_SELF=
argv=Array
argc=4


I'm getting this exact same response. Any advise? I haven't found any replies to this post.\

Thanks
Simspeed
simspeed
PL Nut
 
Posts: 29
Joined: 3:44pm, Wed 15 Mar, 2006
Location: Texas

Update for 2.10.2?

Postby jsmails » 4:47pm, Thu 23 Mar, 2006

This documentation looks great, but I think it may be a bit dated. I'm using 2.10.2 and it appears that some changes have been made to the code since this was written. Does anyone have an update?
jsmails
phpList newbie
 
Posts: 1
Joined: 4:44pm, Thu 23 Mar, 2006

Re: How to make PHPlist work with Cron Jobs

Postby sanjay92 » 8:38pm, Thu 13 Apr, 2006

Where is the bash script is getting called. I see bash script is named phplist and that's what we should be calling in cron.
cronjob should be like this:
home/water/public_html/fountain/admin/phplist page=processqueue login=fish password=seashell

Otherwise, I don't see use of phplist file which was created.
Am I missing something ? I thoght I knew some Shell scripting.
sanjay92
PL Nut
 
Posts: 17
Joined: 8:31pm, Thu 13 Apr, 2006

Pseudo-cron as an alternative to crontab

Postby H2B2 » 2:15pm, Tue 02 May, 2006

As my host doesn't support the use of cron jobs, i looked for another solution to automate message sending. I just stumbled on Pseudo-Cron.

Pseudo cron is a php script that will use html page requests from website visitors to start up, and check if any cron job should have been run since the previous request. If true, the cron job is executed and logged.

Features:
- runs any PHP script
- periodical or time-controlled script execution
- logs all executed jobs
- can be run from an IMG tag in an HTML page
- follows Unix cron syntax for crontabs
- sends an email with the results

The script is free (GPL) and can be found here:
Original script: http://www.bitfolge.de/pseudocron-en.html (take a look at the forum too)
improved version: http://www.digilog.de/fremddaten/pseudo-cron_131.zip

Haven't tried it yet, but will soon. If anyone used pseudo-cron before, I really could use some pointers.

cheers
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

PreviousNext

Return to Advanced Answers, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 1 guest