Cron job run every XX hour?

Version 3 Solutions you have discovered or come across should go here. Questions should go in the other three Version 3 forums, thank you.
Forum rules
Please do not ask questions here, this is for Version 3 Solutions you have discovered or come across.

Cron job run every XX hour?

Postby exosto » 4:09pm, Mon 16 Dec, 2013

Hi All,
I have a question regarding cron job settings taking in mind my config settings & hosting limits, as I have list of 80000 users and I need the e-mails to be sent although my browser is closed.
Email sending limit of my hosting is 300 per hour, so to be sure all the emails will be sent I've set hourly limit of 290 e-mails, with delay of 12 seconds so if some mail delivery & report mail is sent there are 10 e-mails left free to be received in the 1 hour limit... So it will take about 275 hours my campaign to be sent.
Here are my settings in the config file:
define('MAX_PROCESS_MESSAGE',999);
define("MAILQUEUE_BATCH_SIZE",290);
define("MAILQUEUE_BATCH_PERIOD",3600);
define('MAILQUEUE_THROTTLE',12);
define('MAILQUEUE_AUTOTHROTTLE',0);

Here is the cron job, set to run every hour:
Minute Hour Day Month Weekday
0 * * * *
Command Actions:
php -q /home/user/public_html/sitename/subscribe/admin/index.php -pprocessqueue -c/home/user/public_html/sitename/subscribe/config/config.php >/dev/null

The important question is: do I have to set the cron job to run every hour, so after finishing the first batch of 290 mails in 1 hour, the next hour the cron starts the job and next 290 emails will be send, then the next hour & etc.?
exosto
phpList newbie
 
Posts: 1
Joined: 3:45pm, Mon 16 Dec, 2013

Re: Cron job run every XX hour?

Postby danwaterloo » 2:00pm, Tue 17 Dec, 2013

the processqueue command is able to determine how many emails were sent in the last interval, so it dynamically determines how many to send in the current batch. since you have set your interval to 1 hour (3600 secs), and the qty as 290, if you set your cron job to run every hour, it will run the 290 spread out over about an hour (using the 12 sec delay).

if you set your cron job to run every 15 minutes, it will look at how many have been sent in the last 1 hour, and will schedule the remainder. when the processqueue script runs, it looks for and terminates any already running processqueue script (if a previously running script is not finished, it stops it anyways).

in your case, it shouldn't matter if you run it for an interval of less than an hour, it will automatically adjust the quantity for the next interval.

the first interval it will want to send 290 emails, is rate limited to 5/minute (12 s delay). after 15 minutes (i.e you set cron job to run every 15 mins), it will terminate the running cron job, figure out it sent 75 emails in the last hour(5 emails/min * 15 mins), and will want to send 215 emails.

it will send 5/min, and 15 min later, it will start another batch by killing the already running processqueue, determine it has sent 150 emails in the last hour, and will schedule 140 emails.

and it keeps going like this.... eventually stabilizing at about 70-75 emails every 15 mins.
danwaterloo
PL Master
 
Posts: 276
Joined: 3:51am, Wed 30 Oct, 2013
Location: http://www.phplistsupport.com


Return to Answers, HowTos, Tips and Tricks

Who is online

Users browsing this forum: No registered users and 0 guests