Cron job walkthrough

Solutions for other advanced phplisters

Postby Balitas » 1:12pm, Thu 14 Dec, 2006

Guys after take suggestions of H2B2 and evidenthost I setup phplist to not freeze after 300 message as this (I have 5000 susbscribers) and send mails no more than 300 messages to don't have problems with my hosting provider:

config.php:

# define the amount of emails you want to send per period. If 0, batch processing
# is disabled and messages are sent out as fast as possible
define("MAILQUEUE_BATCH_SIZE",8000);

# define the length of one batch processing period, in seconds (3600 is an hour)
define("MAILQUEUE_BATCH_PERIOD",96000);

# to avoid overloading the server that sends your email, you can add a little delay
# between messages that will spread the load of sending
# you will need to find a good value for your own server
# value is in seconds (or you can play with the autothrottle below)
define('MAILQUEUE_THROTTLE',12);

and

# Domain Throttling
# You can activate domain throttling, by setting USE_DOMAIN_THROTTLE to 1
# define the maximum amount of emails you want to allow sending to any domain and the number
# of seconds for that amount. This will make sure you don't send too many emails to one domain
# which may cause blacklisting. Particularly the big ones are tricky about this.
# it may cause a dramatic increase in the amount of time to send a message, depending on how
# many users you have that have the same domain (eg hotmail.com)
# if too many failures for throttling occur, the send process will automatically add an extra
# delay to try to improve that. The example sends 1 message every 2 minutes.

define('USE_DOMAIN_THROTTLE',0);
define('DOMAIN_BATCH_SIZE',5);
define('DOMAIN_BATCH_PERIOD',60);

Then in CronJobs I put this
17 * * * * wget -q -O - 'http://www.mydomain.com/lists/admin/index.php?page=processqueue&login=myusername&password=mypassword&reload=*' >/dev/null

I not try it, but I will confirm in the next days.

Tell me what do you think.

Regards.
Need a website? Enter to www.balitas.com
Balitas
PL Geek
 
Posts: 82
Joined: 2:17am, Mon 13 Feb, 2006

Postby H2B2 » 2:03pm, Thu 14 Dec, 2006

Hmm, with these settings you are sending all messages in just on big batch of 8000 messages. This is an unusual way of applying batch processing.

If you take the approach of sending all messages in one go, I would suggest you just disable batch processing and only use the mailqueue throttle setting to remain within the limits of 300 messages per hour :
define("MAILQUEUE_BATCH_SIZE",0);
define("MAILQUEUE_BATCH_PERIOD",3600);
define('MAILQUEUE_THROTTLE',12);

For the cron job this means that you do not have to use the 'reload' parameter, as you are not using batches.
However, considering that with PHP-cgi you might get timeouts, you would need to process the queue several times, preferably every 20 minutes.

So, you could try this cron job for that purpose:
*/20 * * * * wget -q -O - 'http://www.mydomain.com/lists/admin/index.php?page=processqueue&login=myusername&password=mypassword' >/dev/null

Remember to avoid queuing any new messages, while you are still processing the previous message, which would take about 19 hours for a message load of 5000 and a throttle setting of 12 seconds.

This is basically the solution suggested by jotazzu in his example for a "Cron job without batch processing (PHP-cgi)", see http://docs.phplist.com/CronJobExamples
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Postby Balitas » 6:32am, Fri 15 Dec, 2006

H2B2 I think your solution will be work with me, I will try it and then comment your, thanks!

However with the last change I commented works fine, but as you said is an unusual way.
Need a website? Enter to www.balitas.com
Balitas
PL Geek
 
Posts: 82
Joined: 2:17am, Mon 13 Feb, 2006

Postby Balitas » 4:15pm, Sun 17 Dec, 2006

H2B2 I have a comment. Recently I installed phplist in another domain using Fantastico, and then I setup the installation wih cronjob every 20 minutes, and Fantastico automatically put this in Cronjob in Cpanel:

*/20 * * * * cd '/home/accounthostingname/public_html/lists/admin/' ; php -q index.php -p processqueue > /dev/null ;

I think is the same solution you propose me, what do you think?
Need a website? Enter to www.balitas.com
Balitas
PL Geek
 
Posts: 82
Joined: 2:17am, Mon 13 Feb, 2006

Postby H2B2 » 12:49pm, Mon 18 Dec, 2006

Well, the cron schedule is the same, but the command seems quite different:
- it's a direct call to PHP, with parameters that are normally used with PHP-cli.
- the command is missing the parameters to login.

So you'd best check if that server is running PHP-cli or PHP-cgi.

Ref: http://docs.phplist.com/PhpInterfacesInfo
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Postby Balitas » 3:46pm, Sat 30 Dec, 2006

It works fine! Thanks H2B2.

I have another question. For example when I put two message in queue, and the first one I process queue, then before 20 seconds the another starts.

Is there a way to make the first one finish and then the second one start automatically?

Regards :)
Need a website? Enter to www.balitas.com
Balitas
PL Geek
 
Posts: 82
Joined: 2:17am, Mon 13 Feb, 2006

Postby H2B2 » 3:24pm, Tue 02 Jan, 2007

You could try using the scheduling feature.
ref: http://docs.phplist.com/SendMessageSchedulingInfo
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Postby Balitas » 11:13pm, Sun 07 Jan, 2007

Yeah! Thanks!
Need a website? Enter to www.balitas.com
Balitas
PL Geek
 
Posts: 82
Joined: 2:17am, Mon 13 Feb, 2006

Sorry for the big post, i'm really sorry

Postby Creativeye » 6:01pm, Thu 08 Mar, 2007

Well when i tried to use the codes in the broswer, it opened my admin login page of newsletter. after that i tried setting up cronjob, i got a unusdal error, i tried all the three methods with few minutes difference,
First Setup out put
php -q /home/my site username/public_html/newsletter/admin/index.php? and the newsletter username & password.
i got this out put No input file specified.

Second Setup
curl -s http://www.mydomainname.com/newsletter/ ... e&login=my phplogin&password=myphppassword

the results is as follows.

<!-- using ../config/config.php -->


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html><head>
<meta http-equiv="Cache-Control" content="no-cache, must-revalidate" /> <meta http-equiv="pragma" content="no-cache" /> <link rev="made" href="mailto:phplist%40tincan.co.uk" /> <link rel="home" href="http://www.phplist.com" title="phplist homepage" /> <link rel="copyright" href="http://tincan.co.uk" title="Copyright" /> <link rel="license" href="http://www.gnu.org/copyleft/gpl.html" title="GNU General Public License" /> <meta name="Author" content="Michiel Dethmers - http://www.phplist.com" /> <meta name="Copyright" content="Michiel Dethmers, Tincan Ltd - http://tincan.co.uk" /> <meta name="Powered-By" content="phplist version 2.10.4" /> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

<script language="javascript" type="text/javascript" src="js/select_style.js"></script><meta http-equiv="Cache-Control" content="no-cache, must-revalidate"><meta http-equiv="Pragma" content="no-cache"><title>phplist :: PHPlist :: Send message queue</title> <link href="styles/phplist.css" type="text/css" rel="stylesheet"> </head> <body bgcolor="#ffffff" background="images/bg.png"> <a name="top"></a> <div align=center> <table cellspacing=0 cellpadding=0 width=710 border=0> <tr> <td bgcolor="#000000" rowspan=3><img height=1 alt="" src="images/transparent.png" width=1 border=0></td> <td bgcolor="#000000"><img height=1 alt="" src="images/transparent.png" width=708 border=0></td> <td bgcolor="#000000" rowspan=3><img height=1 alt="" src="images/transparent.png" width=1 border=0></td> </tr>

<tr valign="top" align="left">
<td>
<!--TOP TABLE starts-->
<TABLE cellSpacing=0 cellPadding=0 width=708 bgColor="#ffffff" border=0>
<TR vAlign=top>
<TD colSpan=2 rowspan="2" height="63" background="images/topstrip.png"><a href="http://www.phplist.com" target="_blank"><img src="images/masthead.png" border=0 width=577 height=75 alt=""></a></TD>
<TD align=left
background="images/topstrip.png" bgcolor="#F0D1A3"><FONT
size=-2>&nbsp;<I>powered by: </I><BR>&nbsp;<B>[<A class=powered
href="http://www.php.net/" target=_new><I>PHP</I></A>]</B> + <B>[<A
class=powered href="http://www.mysql.com/"
target=_new>mySQL</A>]</B></FONT></TD></TR>
<TR vAlign=bottom>
<TD vAlign=bottom width=132
background="images/topright.png" bgcolor="#F0D1A3"><SPAN
class=webblermenu>phplist</SPAN></TD></TR>
<TR>
<TD bgColor="#000000"><IMG height=1 alt=""
src="images/transparent.png" width=20
border=0></TD>
<TD bgColor="#000000"><IMG height=1 alt=""
src="images/transparent.png" width=576
border=0></TD>
<TD bgColor="#000000"><IMG height=1 alt=""
src="images/transparent.png" width=132
border=0></TD></TR>
<TR vAlign=top>
<TD>&nbsp;</TD>
<td><div align=left>
<br />
<p class="leaftitle">phplist - send message queue</p><div align="right" id="languageswitch"><br/><form name="languageswitch" method="post" style="margin: 0; padding: 0"><select name="setlanguage" onChange="document.languageswitch.submit()" style="width: 100px; font-size: 10px; color: #666666"><option value="de" >Deutsch </option><option value="en" selected>English </option><option value="es" >espa&ntilde;ol</option><option value="fr" >fran&ccedil;ais </option><option value="pt-br" >portugu&ecirc;s </option><option value="zh-tw" >Traditional Chinese</option></select></form></div><p>This document requires you to log in<br/> <font class="error"></font>


<script language="Javascript" type="text/javascript">

if (!navigator.cookieEnabled) {
document.writeln('<div class="error">In order to login, you need to enable cookies in your browser</div>'); }

</script>
<form method="post" action="">
<input type=hidden name="page" value="processqueue"> <table width=100% border=0 cellpadding=2 cellspacing=0>

<tr><td><span class="general">Name:</span></td></tr>
<tr><td><input type=text name="login" value="" size=30></td></tr>

<tr><td><span class="general">Password:</span></td></tr>
<tr><td><input type=password name="password" value="" size=30></td></tr>

<tr><td><input type=submit name="process" value="Enter"></td></tr></table> </form>


<form method="post" action="">
<input type="hidden" name="page" value="processqueue"> <p align="center"><hr width=50% size=3>

Forgot Password?:

Enter your email: <input type=text name="forgotpassword" value="" size=30>


<input type=submit name="process" value="Send Password">

</form></div>
</td>
<td>
<div class="menutableright">
<span class="menulinkleft"><a href="./?page=home">main page</a><br /></span><span class="menulinkleft"><a href="./?page=about">about phplist</a><br /></span></div> </td> </tr>




<tr><td colspan="4">&nbsp;</td></tr>



<tr><td colspan="4">&nbsp;</td></tr>
</table>
<!--TOP TABLE ends-->

</td></tr>


<tr>
<td bgcolor="#000000" colspan=3><img height=1 alt="" src="images/transparent.png" width=1 border=0></td> </tr>

<tr>
<td bgcolor="#000000"><img height=1 alt="" src="images/transparent.png" width=1 border=0></td> <td bgcolor="#ff9900" class="bottom">&copy; <a href="http://tincan.co.uk" target="_tincan" class="urhere">tincan limited</a> | <span class="urhere">phplist powered by </span><a class="urhere" href="http://www.phplist.com" target="_blank">phplist</a> - version 2.10.4</td> <td bgcolor="#000000"><img height=1 alt="" src="images/transparent.png" width=1 border=0></td> </tr>

<tr>
<td bgcolor="#000000" colspan=3><img height=1 alt="" src="images/transparent.png" width=1 border=0></td> </tr>

<tr>
<td colspan=3><img height=3 alt="" src="images/transparent.png" width=1 border=0></td> </tr>

<tr>
<td colspan=3>
&nbsp;
</td>
</tr>
</tbody>
</table>

</div>
</body></html>
Creativeye
PL Nut
 
Posts: 22
Joined: 7:52am, Sat 24 Feb, 2007

Postby Balitas » 2:15pm, Fri 09 Mar, 2007

For all people with help of many guys here finally I setup the cronjob:


In task manager (cpanel):
Minutes: */20
Hour: *
Day: *
Month: *
Day of the week: *
Command: wget -q -O - 'http://www.YOURDOMAIN.COM/YOURPHPLISTFOLDER/admin/index.php?page=processqueue&login=YOURLOGIN&password=YOURPASSWORD' >/dev/null


In phplist (config.php) to send no more than 250 mails per hour (to not have problems with my hosting provider):

# define the amount of emails you want to send per period. If 0, batch processing
# is disabled and messages are sent out as fast as possible
define("MAILQUEUE_BATCH_SIZE",0);

# define the length of one batch processing period, in seconds (3600 is an hour)
define("MAILQUEUE_BATCH_PERIOD",3600);

# to avoid overloading the server that sends your email, you can add a little delay
# between messages that will spread the load of sending
# you will need to find a good value for your own server
# value is in seconds (or you can play with the autothrottle below)
define('MAILQUEUE_THROTTLE',14);

With all these your phplist will never stop until finish send all the suscribers!
Need a website? Enter to www.balitas.com
Balitas
PL Geek
 
Posts: 82
Joined: 2:17am, Mon 13 Feb, 2006

Thanks

Postby Creativeye » 2:30pm, Fri 09 Mar, 2007

Well Sir,
I have one question in config.php,
wht did you set, manually process queue or automatically process queue. please elaborate. so we can fix this issue.
Creativeye
PL Nut
 
Posts: 22
Joined: 7:52am, Sat 24 Feb, 2007

Postby Balitas » 2:34pm, Fri 09 Mar, 2007

I do this:

# set this to 0, if you set up a cron to download bounces regularly by using the
# commandline option. If this is 0, users cannot run the page from the web
# frontend. Read README.commandline to find out how to set it up on the
# commandline
define ("MANUALLY_PROCESS_BOUNCES",1);


# If you set up your system to send the message automatically, you can set this value
# to 0, so "Process Queue" will disappear from the site
# this will also stop users from loading the page on the web frontend, so you will
# have to make sure that you run the queue from the commandline
# check README.commandline how to do this
define ("MANUALLY_PROCESS_QUEUE",1);


Regards :D
Need a website? Enter to www.balitas.com
Balitas
PL Geek
 
Posts: 82
Joined: 2:17am, Mon 13 Feb, 2006

Postby Creativeye » 2:49pm, Fri 09 Mar, 2007

My Friend One last question do we have to place the commands inside the ' ' as you have mentioned in your commands

Command: wget -q -O -'http://www.YOURDOMAIN.COM/YOURPHPLISTFOLDER/admin/index.php?page=processqueue&login=YOURLOGIN&password=YOURPASSWORD' >/dev/null
Creativeye
PL Nut
 
Posts: 22
Joined: 7:52am, Sat 24 Feb, 2007

Postby Balitas » 2:55pm, Fri 09 Mar, 2007

Don't worry, put all the command as I mentioned:

wget -q -O -'http://www.YOURDOMAIN.COM/YOURPHPLISTFOLDER/admin/index.php?page=processqueue&login=YOURLOGIN&password=YOURPASSWORD' >/dev/null
Need a website? Enter to www.balitas.com
Balitas
PL Geek
 
Posts: 82
Joined: 2:17am, Mon 13 Feb, 2006

Thank you Sir,

Postby Creativeye » 5:30am, Sat 10 Mar, 2007

Well after reading all the posts here finally I’m able to configure my phplist, thanks for each and every contributor in this post.

But I have noticed one more issue, I have configured, config php to send report of bounced mails, I do get so many bounced mails, but in process bounce, nothing seems to be there. How is that possible? Aslo one more issue, is my configure setting is as follows,

# define the amount of emails you want to send per period. If 0, batch processing
# is disabled and messages are sent out as fast as possible
define("MAILQUEUE_BATCH_SIZE", 0);

# define the length of one batch processing period, in seconds (3600 is an hour)
define("MAILQUEUE_BATCH_PERIOD",3600);

# to avoid overloading the server that sends your email, you can add a little delay
# between messages that will spread the load of sending
# you will need to find a good value for your own server
# value is in seconds (or you can play with the autothrottle below)
define('MAILQUEUE_THROTTLE',15);

but in phplist admin area, when I click on message, I see the process section right below that it says processing 59 message per hour. How come only 59 when as per my setting it should process 240 mails.
Creativeye
PL Nut
 
Posts: 22
Joined: 7:52am, Sat 24 Feb, 2007

PreviousNext

Return to Advanced Answers, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 1 guest

cron