FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Hourly script
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Hourly script [message #173298] Sat, 02 April 2011 17:38 Go to next message
Question Boy is currently offline  Question Boy
Messages: 8
Registered: April 2011
Karma: 0
Junior Member
I built a mailing tool for a custom database for a charity
organisation and it does work, but our host has a limit of 200 e-mails
an hour. As it stands, someone has to manually send out 200 e-mails
every hour until the whole lot is processed (2800 recipients and
growing). I was simply wondering if there is a way to modify/add a
bit of code to process the entire recordset in batches of 200 records
per hour?

Any help would be truly appreciated.

QB
Re: Hourly script [message #173299 is a reply to message #173298] Sat, 02 April 2011 17:40 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 4/2/2011 1:38 PM, Question Boy wrote:
> I built a mailing tool for a custom database for a charity
> organisation and it does work, but our host has a limit of 200 e-mails
> an hour. As it stands, someone has to manually send out 200 e-mails
> every hour until the whole lot is processed (2800 recipients and
> growing). I was simply wondering if there is a way to modify/add a
> bit of code to process the entire recordset in batches of 200 records
> per hour?
>
> Any help would be truly appreciated.
>
> QB

Store the information in a database and have a cron job kick off every
hour to send the email.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Hourly script [message #173300 is a reply to message #173299] Sat, 02 April 2011 17:42 Go to previous messageGo to next message
Question Boy is currently offline  Question Boy
Messages: 8
Registered: April 2011
Karma: 0
Junior Member
On Apr 2, 1:40 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> On 4/2/2011 1:38 PM, Question Boy wrote:
>
>> I built a mailing tool for a custom database for a charity
>> organisation and it does work, but our host has a limit of 200 e-mails
>> an hour.  As it stands, someone has to manually send out 200 e-mails
>> every hour until the whole lot is processed (2800 recipients and
>> growing).  I was simply wondering if there is a way to modify/add a
>> bit of code to process the entire recordset in batches of 200 records
>> per hour?
>
>> Any help would be truly appreciated.
>
>> QB
>
> Store the information in a database and have a cron job kick off every
> hour to send the email.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================

Call me ignorant, but could you elaborate just a little more. Thank
you!
Re: Hourly script [message #173301 is a reply to message #173298] Sat, 02 April 2011 17:54 Go to previous messageGo to next message
Luuk is currently offline  Luuk
Messages: 329
Registered: September 2010
Karma: 0
Senior Member
On 02-04-2011 19:38, Question Boy wrote:
> I built a mailing tool for a custom database for a charity
> organisation and it does work, but our host has a limit of 200 e-mails
> an hour. As it stands, someone has to manually send out 200 e-mails
> every hour until the whole lot is processed (2800 recipients and
> growing). I was simply wondering if there is a way to modify/add a
> bit of code to process the entire recordset in batches of 200 records
> per hour?
>
> Any help would be truly appreciated.
>
> QB

Best way to solve this is to get rid of the limit of 200 e-mails an hour

Unless, of course, you can live with the fact that e-mails wil take 14
hours to be sent, and mod hourse when the number of users grow...

--
Luuk
Re: Hourly script [message #173302 is a reply to message #173300] Sat, 02 April 2011 17:56 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 4/2/2011 1:42 PM, Question Boy wrote:
> On Apr 2, 1:40 pm, Jerry Stuckle<jstuck...@attglobal.net> wrote:
>> On 4/2/2011 1:38 PM, Question Boy wrote:
>>
>>> I built a mailing tool for a custom database for a charity
>>> organisation and it does work, but our host has a limit of 200 e-mails
>>> an hour. As it stands, someone has to manually send out 200 e-mails
>>> every hour until the whole lot is processed (2800 recipients and
>>> growing). I was simply wondering if there is a way to modify/add a
>>> bit of code to process the entire recordset in batches of 200 records
>>> per hour?
>>
>>> Any help would be truly appreciated.
>>
>>> QB
>>
>> Store the information in a database and have a cron job kick off every
>> hour to send the email.
>>
>> --
>> ==================
>> Remove the "x" from my email address
>> Jerry Stuckle
>> JDS Computer Training Corp.
>> jstuck...@attglobal.net
>> ==================
>
> Call me ignorant, but could you elaborate just a little more. Thank
> you!

http://www.lmgtfy.com/?q=cron

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Hourly script [message #173303 is a reply to message #173298] Sat, 02 April 2011 17:58 Go to previous messageGo to next message
Eli the Bearded is currently offline  Eli the Bearded
Messages: 22
Registered: April 2011
Karma: 0
Junior Member
In comp.lang.php, Question Boy <question(dot)boy(at)hotmail(dot)com> wrote:
> I built a mailing tool for a custom database for a charity
> organisation and it does work, but our host has a limit of 200 e-mails
> an hour. As it stands, someone has to manually send out 200 e-mails
> every hour until the whole lot is processed (2800 recipients and
> growing). I was simply wondering if there is a way to modify/add a
> bit of code to process the entire recordset in batches of 200 records
> per hour?

200 / hour = 1 / 18 seconds.

foreach($address_list as $recip) {
sendone($recip);
sleep(18);
}


Elijah
------
you might need to change a lot timeouts or not run from a web page
Re: Hourly script [message #173304 is a reply to message #173298] Sat, 02 April 2011 20:37 Go to previous messageGo to next message
P E Schoen is currently offline  P E Schoen
Messages: 86
Registered: January 2011
Karma: 0
Member
"Question Boy" wrote in message
news:bc56da6b-df1c-4a56-9789-78fd24c0268d(at)s9g2000yqm(dot)googlegroups(dot)com...

> I built a mailing tool for a custom database for a charity
> organisation and it does work, but our host has a limit of
> 200 e-mails an hour. As it stands, someone has to manually
> send out 200 e-mails every hour until the whole lot is processed
> (2800 recipients and growing). I was simply wondering if there
> is a way to modify/add a bit of code to process the entire
> recordset in batches of 200 records per hour?

The other responses are probably all you need. The CRON job seems to require
access to the UNIX environment, and I'm not sure how that might be done if
you are working from a Windows platform. There are many ways to do this, but
the best way may depend on just how your script is written. I am assuming it
is PHP and is running on either a remote host or your localhost Apache
server or equivalent.

Since I am using a Win7 machine, which may go to sleep or shut down once in
a while, it would make better sense to run whatever scheduling application
on the remote server. And in that case, of course, the address list and the
content would need to be there as well, probably in a MySQL or similar
database. I found the following that may help:
http://www.phpjobscheduler.co.uk/

Otherwise, there may be some free email servers that permit mass mailings,
and if not, there are some that seem to be inexpensive. Here are some
reviews: http://email.about.com/od/freeemailreviews/tp/free_email.htm

Paul
Re: Hourly script [message #173306 is a reply to message #173304] Sat, 02 April 2011 22:18 Go to previous messageGo to next message
Mr. B-o-B is currently offline  Mr. B-o-B
Messages: 42
Registered: April 2011
Karma: 0
Member
On 4/2/2011 3:37 PM, P E Schoen cried from the depths of the abyss:
> "Question Boy" wrote in message
> news:bc56da6b-df1c-4a56-9789-78fd24c0268d(at)s9g2000yqm(dot)googlegroups(dot)com...
>
>> I built a mailing tool for a custom database for a charity
>> organisation and it does work, but our host has a limit of
>> 200 e-mails an hour. As it stands, someone has to manually
>> send out 200 e-mails every hour until the whole lot is processed
>> (2800 recipients and growing). I was simply wondering if there
>> is a way to modify/add a bit of code to process the entire
>> recordset in batches of 200 records per hour?
>
> The other responses are probably all you need. The CRON job seems to
> require access to the UNIX environment, and I'm not sure how that might
> be done if you are working from a Windows platform. There are many ways
> to do this, but the best way may depend on just how your script is
> written. I am assuming it is PHP and is running on either a remote host
> or your localhost Apache server or equivalent.

You will need shell access to run a cron locally on the host. If that
is not an option, you can use a cron on another *nix box to hit a script
that will send 200 messages.
lynx -dump /webserver/script.php is a good one.

This can also be done from a remote windows box as well using scheduled
tasks.

I myself would just program the email script to send 200 messages / wait
for the duration of the hour, repeat until all messages are sent.



>
> Since I am using a Win7 machine, which may go to sleep or shut down once
> in a while, it would make better sense to run whatever scheduling
> application on the remote server.

So why not tell your 7 box to never go to sleep?

> And in that case, of course, the
> address list and the content would need to be there as well, probably in
> a MySQL or similar database. I found the following that may help:
> http://www.phpjobscheduler.co.uk/
>
> Otherwise, there may be some free email servers that permit mass
> mailings, and if not, there are some that seem to be inexpensive. Here
> are some reviews:
> http://email.about.com/od/freeemailreviews/tp/free_email.htm
>
> Paul

Do a google search for "unlimited smtp access". Find a cheap one, and
be done with it.
Re: Hourly script [message #173307 is a reply to message #173298] Sat, 02 April 2011 23:18 Go to previous messageGo to next message
Jim Higgins is currently offline  Jim Higgins
Messages: 20
Registered: November 2010
Karma: 0
Junior Member
On Sat, 2 Apr 2011 10:38:48 -0700 (PDT), Question Boy
<question(dot)boy(at)hotmail(dot)com> wrote:

> I built a mailing tool for a custom database for a charity
> organisation and it does work, but our host has a limit of 200 e-mails
> an hour. As it stands, someone has to manually send out 200 e-mails
> every hour until the whole lot is processed (2800 recipients and
> growing). I was simply wondering if there is a way to modify/add a
> bit of code to process the entire recordset in batches of 200 records
> per hour?
>
> Any help would be truly appreciated.


If I were you I'd give priority to getting the 200 emails per hour
limit lifted.
Re: Hourly script [message #173308 is a reply to message #173307] Sat, 02 April 2011 23:56 Go to previous messageGo to next message
Question Boy is currently offline  Question Boy
Messages: 8
Registered: April 2011
Karma: 0
Junior Member
On Apr 2, 7:18 pm, Jim Higgins <inva...@invalid.invalid> wrote:
> On Sat, 2 Apr 2011 10:38:48 -0700 (PDT), Question Boy
>
> <question....@hotmail.com> wrote:
>> I built a mailing tool for a custom database for a charity
>> organisation and it does work, but our host has a limit of 200 e-mails
>> an hour.  As it stands, someone has to manually send out 200 e-mails
>> every hour until the whole lot is processed (2800 recipients and
>> growing).  I was simply wondering if there is a way to modify/add a
>> bit of code to process the entire recordset in batches of 200 records
>> per hour?
>
>> Any help would be truly appreciated.
>
> If I were you I'd give priority to getting the 200 emails per hour
> limit lifted.

The host will not change this and I have been unable to convince the
charity to move to another host. So it looks like I will seriously
look into one of the other proposed solutions.

Thank you all for the advice!

QB
Re: Hourly script [message #173310 is a reply to message #173304] Sun, 03 April 2011 00:06 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 4/2/2011 4:37 PM, P E Schoen wrote:
> "Question Boy" wrote in message
> news:bc56da6b-df1c-4a56-9789-78fd24c0268d(at)s9g2000yqm(dot)googlegroups(dot)com...
>
>> I built a mailing tool for a custom database for a charity
>> organisation and it does work, but our host has a limit of
>> 200 e-mails an hour. As it stands, someone has to manually
>> send out 200 e-mails every hour until the whole lot is processed
>> (2800 recipients and growing). I was simply wondering if there
>> is a way to modify/add a bit of code to process the entire
>> recordset in batches of 200 records per hour?
>
> The other responses are probably all you need. The CRON job seems to
> require access to the UNIX environment, and I'm not sure how that might
> be done if you are working from a Windows platform. There are many ways
> to do this, but the best way may depend on just how your script is
> written. I am assuming it is PHP and is running on either a remote host
> or your localhost Apache server or equivalent.
>

Windows also has scheduled tasks. But since the vast majority of the
web servers use Linux, I recommended the Linux version.

> Since I am using a Win7 machine, which may go to sleep or shut down once
> in a while, it would make better sense to run whatever scheduling
> application on the remote server. And in that case, of course, the
> address list and the content would need to be there as well, probably in
> a MySQL or similar database. I found the following that may help:
> http://www.phpjobscheduler.co.uk/
>

Not if it's a web server it shouldn't!

> Otherwise, there may be some free email servers that permit mass
> mailings, and if not, there are some that seem to be inexpensive. Here
> are some reviews:
> http://email.about.com/od/freeemailreviews/tp/free_email.htm
>
> Paul


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Hourly script [message #173311 is a reply to message #173306] Sun, 03 April 2011 00:09 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 4/2/2011 6:18 PM, Mr. B-o-B wrote:
> On 4/2/2011 3:37 PM, P E Schoen cried from the depths of the abyss:
>> "Question Boy" wrote in message
>> news:bc56da6b-df1c-4a56-9789-78fd24c0268d(at)s9g2000yqm(dot)googlegroups(dot)com...
>>
>>> I built a mailing tool for a custom database for a charity
>>> organisation and it does work, but our host has a limit of
>>> 200 e-mails an hour. As it stands, someone has to manually
>>> send out 200 e-mails every hour until the whole lot is processed
>>> (2800 recipients and growing). I was simply wondering if there
>>> is a way to modify/add a bit of code to process the entire
>>> recordset in batches of 200 records per hour?
>>
>> The other responses are probably all you need. The CRON job seems to
>> require access to the UNIX environment, and I'm not sure how that might
>> be done if you are working from a Windows platform. There are many ways
>> to do this, but the best way may depend on just how your script is
>> written. I am assuming it is PHP and is running on either a remote host
>> or your localhost Apache server or equivalent.
>
> You will need shell access to run a cron locally on the host. If that is
> not an option, you can use a cron on another *nix box to hit a script
> that will send 200 messages.
> lynx -dump /webserver/script.php is a good one.
>

No you don't. There are webmaster tools which allow you to set up cron
jobs.

> This can also be done from a remote windows box as well using scheduled
> tasks.
>

Oh gawd - why would you EVER want to do that?

> I myself would just program the email script to send 200 messages / wait
> for the duration of the hour, repeat until all messages are sent.
>
>

And exactly how are you going to do that?

>
>>
>> Since I am using a Win7 machine, which may go to sleep or shut down once
>> in a while, it would make better sense to run whatever scheduling
>> application on the remote server.
>
> So why not tell your 7 box to never go to sleep?
>

Exactly.

>> And in that case, of course, the
>> address list and the content would need to be there as well, probably in
>> a MySQL or similar database. I found the following that may help:
>> http://www.phpjobscheduler.co.uk/
>>
>> Otherwise, there may be some free email servers that permit mass
>> mailings, and if not, there are some that seem to be inexpensive. Here
>> are some reviews:
>> http://email.about.com/od/freeemailreviews/tp/free_email.htm
>>
>> Paul
>
> Do a google search for "unlimited smtp access". Find a cheap one, and be
> done with it.
>

A very good suggestion.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Hourly script [message #173312 is a reply to message #173311] Sun, 03 April 2011 00:18 Go to previous messageGo to next message
Mr. B-o-B is currently offline  Mr. B-o-B
Messages: 42
Registered: April 2011
Karma: 0
Member
On 4/2/2011 7:09 PM, Jerry Stuckle cried from the depths of the abyss:
> On 4/2/2011 6:18 PM, Mr. B-o-B wrote:
>> On 4/2/2011 3:37 PM, P E Schoen cried from the depths of the abyss:
>>> "Question Boy" wrote in message
>>> news:bc56da6b-df1c-4a56-9789-78fd24c0268d(at)s9g2000yqm(dot)googlegroups(dot)com...
>>>
>>>> I built a mailing tool for a custom database for a charity
>>>> organisation and it does work, but our host has a limit of
>>>> 200 e-mails an hour. As it stands, someone has to manually
>>>> send out 200 e-mails every hour until the whole lot is processed
>>>> (2800 recipients and growing). I was simply wondering if there
>>>> is a way to modify/add a bit of code to process the entire
>>>> recordset in batches of 200 records per hour?
>>>
>>> The other responses are probably all you need. The CRON job seems to
>>> require access to the UNIX environment, and I'm not sure how that might
>>> be done if you are working from a Windows platform. There are many ways
>>> to do this, but the best way may depend on just how your script is
>>> written. I am assuming it is PHP and is running on either a remote host
>>> or your localhost Apache server or equivalent.
>>
>> You will need shell access to run a cron locally on the host. If that is
>> not an option, you can use a cron on another *nix box to hit a script
>> that will send 200 messages.
>> lynx -dump /webserver/script.php is a good one.
>>
>
> No you don't. There are webmaster tools which allow you to set up cron
> jobs.

This is true.

>
>> This can also be done from a remote windows box as well using scheduled
>> tasks.
>>
>
> Oh gawd - why would you EVER want to do that?

Despirate times call for despirate measures.

>
>> I myself would just program the email script to send 200 messages / wait
>> for the duration of the hour, repeat until all messages are sent.
>>
>>
>
> And exactly how are you going to do that?

It's fairly easy to time a script, and make it sleep for the difference.

>
>>
>>>
>>> Since I am using a Win7 machine, which may go to sleep or shut down once
>>> in a while, it would make better sense to run whatever scheduling
>>> application on the remote server.
>>
>> So why not tell your 7 box to never go to sleep?
>>
>
> Exactly.
>
>>> And in that case, of course, the
>>> address list and the content would need to be there as well, probably in
>>> a MySQL or similar database. I found the following that may help:
>>> http://www.phpjobscheduler.co.uk/
>>>
>>> Otherwise, there may be some free email servers that permit mass
>>> mailings, and if not, there are some that seem to be inexpensive. Here
>>> are some reviews:
>>> http://email.about.com/od/freeemailreviews/tp/free_email.htm
>>>
>>> Paul
>>
>> Do a google search for "unlimited smtp access". Find a cheap one, and be
>> done with it.
>>
>
> A very good suggestion.
>
Re: Hourly script [message #173313 is a reply to message #173312] Sun, 03 April 2011 02:00 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 4/2/2011 8:18 PM, Mr. B-o-B wrote:
> On 4/2/2011 7:09 PM, Jerry Stuckle cried from the depths of the abyss:
>> On 4/2/2011 6:18 PM, Mr. B-o-B wrote:
>>> On 4/2/2011 3:37 PM, P E Schoen cried from the depths of the abyss:
>>>> "Question Boy" wrote in message
>>>> news:bc56da6b-df1c-4a56-9789-78fd24c0268d(at)s9g2000yqm(dot)googlegroups(dot)com...
>>>>
>>>>
>>>> > I built a mailing tool for a custom database for a charity
>>>> > organisation and it does work, but our host has a limit of
>>>> > 200 e-mails an hour. As it stands, someone has to manually
>>>> > send out 200 e-mails every hour until the whole lot is processed
>>>> > (2800 recipients and growing). I was simply wondering if there
>>>> > is a way to modify/add a bit of code to process the entire
>>>> > recordset in batches of 200 records per hour?
>>>>
>>>> The other responses are probably all you need. The CRON job seems to
>>>> require access to the UNIX environment, and I'm not sure how that might
>>>> be done if you are working from a Windows platform. There are many ways
>>>> to do this, but the best way may depend on just how your script is
>>>> written. I am assuming it is PHP and is running on either a remote host
>>>> or your localhost Apache server or equivalent.
>>>
>>> You will need shell access to run a cron locally on the host. If that is
>>> not an option, you can use a cron on another *nix box to hit a script
>>> that will send 200 messages.
>>> lynx -dump /webserver/script.php is a good one.
>>>
>>
>> No you don't. There are webmaster tools which allow you to set up cron
>> jobs.
>
> This is true.
>
>>
>>> This can also be done from a remote windows box as well using scheduled
>>> tasks.
>>>
>>
>> Oh gawd - why would you EVER want to do that?
>
> Despirate times call for despirate measures.
>

And what happens if your windows box gets shut off? Or the link fails?
Or any of a bunch of other things that can happen?

It's a terrible suggestion.

>>
>>> I myself would just program the email script to send 200 messages / wait
>>> for the duration of the hour, repeat until all messages are sent.
>>>
>>>
>>
>> And exactly how are you going to do that?
>
> It's fairly easy to time a script, and make it sleep for the difference.
>

And what happens when the script times out? Or it crashes? Or the
server is rebooted? Or the host kills it because it's been running for
so long? Or any of a hundred other things which can go wrong?

Another bad suggestion, actually.

>>
>>>
>>>>
>>>> Since I am using a Win7 machine, which may go to sleep or shut down
>>>> once
>>>> in a while, it would make better sense to run whatever scheduling
>>>> application on the remote server.
>>>
>>> So why not tell your 7 box to never go to sleep?
>>>
>>
>> Exactly.
>>
>>>> And in that case, of course, the
>>>> address list and the content would need to be there as well,
>>>> probably in
>>>> a MySQL or similar database. I found the following that may help:
>>>> http://www.phpjobscheduler.co.uk/
>>>>
>>>> Otherwise, there may be some free email servers that permit mass
>>>> mailings, and if not, there are some that seem to be inexpensive. Here
>>>> are some reviews:
>>>> http://email.about.com/od/freeemailreviews/tp/free_email.htm
>>>>
>>>> Paul
>>>
>>> Do a google search for "unlimited smtp access". Find a cheap one, and be
>>> done with it.
>>>
>>
>> A very good suggestion.
>>
>


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Hourly script [message #173315 is a reply to message #173311] Sun, 03 April 2011 03:02 Go to previous messageGo to next message
Michael Fesser is currently offline  Michael Fesser
Messages: 215
Registered: September 2010
Karma: 0
Senior Member
.oO(Jerry Stuckle)

> On 4/2/2011 6:18 PM, Mr. B-o-B wrote:
>>
>> This can also be done from a remote windows box as well using scheduled
>> tasks.
>
> Oh gawd - why would you EVER want to do that?

If the hosting plan doesn't include cron jobs and you don't want to pay
twice as much for a little site, then IMHO triggering such jobs from the
outside is acceptable.

On some of the sites that I maintain I use this to update their access
statistics. The client's hosting plan doesn't include cron jobs, so my
own local server (24/7) calls the AWStats update script on these sites
every few hours. Pretty simple, cheap and reliable, as long as my own
DSL link doesn't go down. But in this case it's only about statistics.

Micha
Re: Hourly script [message #173317 is a reply to message #173313] Sun, 03 April 2011 11:03 Go to previous messageGo to next message
Luuk is currently offline  Luuk
Messages: 329
Registered: September 2010
Karma: 0
Senior Member
On 03-04-2011 04:00, Jerry Stuckle wrote:
> And what happens when the script times out? Or it crashes? Or the
> server is rebooted? Or the host kills it because it's been running for
> so long? Or any of a hundred other things which can go wrong?

The script that actually send a message (an email-message in this case)
should of course mark the message a being send.

A restart of the script should skipp all messages that already have been
send...



--
Luuk
Re: Hourly script [message #173324 is a reply to message #173317] Sun, 03 April 2011 12:46 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 4/3/2011 7:03 AM, Luuk wrote:
> On 03-04-2011 04:00, Jerry Stuckle wrote:
>> And what happens when the script times out? Or it crashes? Or the
>> server is rebooted? Or the host kills it because it's been running for
>> so long? Or any of a hundred other things which can go wrong?
>
> The script that actually send a message (an email-message in this case)
> should of course mark the message a being send.
>
> A restart of the script should skipp all messages that already have been
> send...
>
>
>

And how is it to know? How is it going to keep track of messages?

Yes, there are ways - but the op mentioned nothing about these. And if
the script is killed, potentially hundreds of messages could go unsent.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Hourly script [message #173325 is a reply to message #173315] Sun, 03 April 2011 12:53 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 4/2/2011 11:02 PM, Michael Fesser wrote:
> .oO(Jerry Stuckle)
>
>> On 4/2/2011 6:18 PM, Mr. B-o-B wrote:
>>>
>>> This can also be done from a remote windows box as well using scheduled
>>> tasks.
>>
>> Oh gawd - why would you EVER want to do that?
>
> If the hosting plan doesn't include cron jobs and you don't want to pay
> twice as much for a little site, then IMHO triggering such jobs from the
> outside is acceptable.
>
> On some of the sites that I maintain I use this to update their access
> statistics. The client's hosting plan doesn't include cron jobs, so my
> own local server (24/7) calls the AWStats update script on these sites
> every few hours. Pretty simple, cheap and reliable, as long as my own
> DSL link doesn't go down. But in this case it's only about statistics.
>
> Micha

Updating AWStats once a day is quite different from sending emails.
Triggering from another machine makes just about as much sense as
hosting the site in your own home. Too many things can go wrong and the
emails not get sent.

And it doesn't cost "twice as much" to find a host which does support
cron jobs, unless you have a super-cheap hosting plan. (But then I've
never seen those plans be worth the money; they're great until something
happens.)



--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Hourly script [message #173327 is a reply to message #173313] Sun, 03 April 2011 14:22 Go to previous messageGo to next message
Mr. B-o-B is currently offline  Mr. B-o-B
Messages: 42
Registered: April 2011
Karma: 0
Member
Jerry Stuckle cried from the depths of the abyss...

> On 4/2/2011 8:18 PM, Mr. B-o-B wrote:
>> On 4/2/2011 7:09 PM, Jerry Stuckle cried from the depths of the abyss:
>>> On 4/2/2011 6:18 PM, Mr. B-o-B wrote:
>>>> On 4/2/2011 3:37 PM, P E Schoen cried from the depths of the abyss:
>>>> > "Question Boy" wrote in message
>>>> > news:bc56da6b-df1c-4a56-9789-78fd24c0268d(at)s9g2000yqm(dot)googlegroups(dot)com...
>>>> >
>>>> >
>>>> >> I built a mailing tool for a custom database for a charity
>>>> >> organisation and it does work, but our host has a limit of
>>>> >> 200 e-mails an hour. As it stands, someone has to manually
>>>> >> send out 200 e-mails every hour until the whole lot is processed
>>>> >> (2800 recipients and growing). I was simply wondering if there
>>>> >> is a way to modify/add a bit of code to process the entire
>>>> >> recordset in batches of 200 records per hour?
>>>> >
>>>> > The other responses are probably all you need. The CRON job seems to
>>>> > require access to the UNIX environment, and I'm not sure how that might
>>>> > be done if you are working from a Windows platform. There are many ways
>>>> > to do this, but the best way may depend on just how your script is
>>>> > written. I am assuming it is PHP and is running on either a remote host
>>>> > or your localhost Apache server or equivalent.
>>>>
>>>> You will need shell access to run a cron locally on the host. If that is
>>>> not an option, you can use a cron on another *nix box to hit a script
>>>> that will send 200 messages.
>>>> lynx -dump /webserver/script.php is a good one.
>>>>
>>>
>>> No you don't. There are webmaster tools which allow you to set up cron
>>> jobs.
>>
>> This is true.
>>
>>>
>>>> This can also be done from a remote windows box as well using scheduled
>>>> tasks.
>>>>
>>>
>>> Oh gawd - why would you EVER want to do that?
>>
>> Despirate times call for despirate measures.
>>
>
> And what happens if your windows box gets shut off? Or the link fails? Or
> any of a bunch of other things that can happen?
>
> It's a terrible suggestion.
>

I use this trick for various things at work, and have never had a problem.
Not a terrible idea if you think about it.

>>>
>>>> I myself would just program the email script to send 200 messages / wait
>>>> for the duration of the hour, repeat until all messages are sent.
>>>>
>>>>
>>>
>>> And exactly how are you going to do that?
>>
>> It's fairly easy to time a script, and make it sleep for the difference.
>>
>
> And what happens when the script times out? Or it crashes? Or the server is
> rebooted? Or the host kills it because it's been running for so long? Or
> any of a hundred other things which can go wrong?
>
> Another bad suggestion, actually.
>

Cheesit's Rice Man. Get in the game here. One can modify the php.ini
(max_execution_time) to be 61 minutes. If access to modify php.ini in not
available one can change this in the script itself using the ini_set
option so it will not time out.
Crashes? Then this guy should find a new host. As for the reboot. Who
cares. If this is setup properly, it will run again at the desired time
(post reboot) and process the remaining pending messages. It's not a bad
idea.



>>>
>>>>
>>>> >
>>>> > Since I am using a Win7 machine, which may go to sleep or shut down
>>>> > once
>>>> > in a while, it would make better sense to run whatever scheduling
>>>> > application on the remote server.
>>>>
>>>> So why not tell your 7 box to never go to sleep?
>>>>
>>>
>>> Exactly.
>>>
>>>> > And in that case, of course, the
>>>> > address list and the content would need to be there as well,
>>>> > probably in
>>>> > a MySQL or similar database. I found the following that may help:
>>>> > http://www.phpjobscheduler.co.uk/
>>>> >
>>>> > Otherwise, there may be some free email servers that permit mass
>>>> > mailings, and if not, there are some that seem to be inexpensive. Here
>>>> > are some reviews:
>>>> > http://email.about.com/od/freeemailreviews/tp/free_email.htm
>>>> >
>>>> > Paul
>>>>
>>>> Do a google search for "unlimited smtp access". Find a cheap one, and be
>>>> done with it.
>>>>
>>>
>>> A very good suggestion.
>>>
>>
Re: Hourly script [message #173328 is a reply to message #173324] Sun, 03 April 2011 15:12 Go to previous messageGo to next message
Mr. B-o-B is currently offline  Mr. B-o-B
Messages: 42
Registered: April 2011
Karma: 0
Member
Jerry Stuckle cried from the depths of the abyss...

> On 4/3/2011 7:03 AM, Luuk wrote:
>> On 03-04-2011 04:00, Jerry Stuckle wrote:
>>> And what happens when the script times out? Or it crashes? Or the
>>> server is rebooted? Or the host kills it because it's been running for
>>> so long? Or any of a hundred other things which can go wrong?
>>
>> The script that actually send a message (an email-message in this case)
>> should of course mark the message a being send.
>>
>> A restart of the script should skipp all messages that already have been
>> send...
>>
>>
>>
>
> And how is it to know? How is it going to keep track of messages?

This is not at all a problem. Assuming the OP has access to mysql(or
another sql db), or at least the ability to create a table in the db then
the script should create a temp table to store all the message that need
to be sent. One of the keys should be something like "message_sent".
When the script re-runs it should check for the temp table, if it exists
continue with message sending otherwise (new batch of messages ) create a
new temp table & populate with the message list.

Then in a nutshell the script will query the temp table
"SELECT * FROM temp WHERE message_sent <> 'yes'";

Start iteration on the above results.
After each message is send, update the message record to message_sent =
'yes' or however you want to mark it as flagged.

At the start of the script note the time of the script start. Calculate
endtime +59 minutes from start time. Also set a $messages_sent var to
0. Each message should ++ this var. Each iteration should check the time
first not to exceed 60 minutes or 200 messages sent.

if ($end_time >= $right_now_loop_time || $messages_sent <= 200) {
proceed to send messages
$messages_sent++
update table query to mark message as sent
}
else{
exit(0)
}

You should also incorporate a nrow check on the table into the script.
Once the last stored record(message) is processed(sent) the temp table
should be dropped & exit the script.

This entire process can of course be done using a file to store the
messages on the localfile system as well (if db not available).


> Yes, there are ways - but the op mentioned nothing about these. And if the
> script is killed, potentially hundreds of messages could go unsent.

Negative. It's not rocket science. This is not really a problem if one
takes 25 seconds to think it over. Unfortunately you only gave it a
couple seconds before you decided that the very easy is impossible.
Re: Hourly script [message #173329 is a reply to message #173328] Sun, 03 April 2011 15:26 Go to previous messageGo to next message
Mr. B-o-B is currently offline  Mr. B-o-B
Messages: 42
Registered: April 2011
Karma: 0
Member
On 4/3/2011 10:12 AM, Mr. B-o-B cried from the depths of the abyss:
> Jerry Stuckle cried from the depths of the abyss...
>
>> On 4/3/2011 7:03 AM, Luuk wrote:
>>> On 03-04-2011 04:00, Jerry Stuckle wrote:
>>>> And what happens when the script times out? Or it crashes? Or the
>>>> server is rebooted? Or the host kills it because it's been running for
>>>> so long? Or any of a hundred other things which can go wrong?
>>>
>>> The script that actually send a message (an email-message in this case)
>>> should of course mark the message a being send.
>>>
>>> A restart of the script should skipp all messages that already have been
>>> send...
>>>
>>>
>>>
>>
>> And how is it to know? How is it going to keep track of messages?
>
> This is not at all a problem. Assuming the OP has access to mysql(or
> another sql db), or at least the ability to create a table in the db
> then the script should create a temp table to store all the message that
> need to be sent. One of the keys should be something like
> "message_sent". When the script re-runs it should check for the temp
> table, if it exists continue with message sending otherwise (new batch
> of messages ) create a new temp table & populate with the message list.
>
> Then in a nutshell the script will query the temp table
> "SELECT * FROM temp WHERE message_sent <> 'yes'";
>
> Start iteration on the above results.
> After each message is send, update the message record to message_sent =
> 'yes' or however you want to mark it as flagged.
>
> At the start of the script note the time of the script start. Calculate
> endtime +59 minutes from start time. Also set a $messages_sent var to 0.
> Each message should ++ this var. Each iteration should check the time
> first not to exceed 60 minutes or 200 messages sent.
>
> if ($end_time >= $right_now_loop_time || $messages_sent <= 200) {
> proceed to send messages
> $messages_sent++
> update table query to mark message as sent
> }
> else{
> exit(0)
> }
>

My Bad. This should actually be && and not ||

> if ($end_time >= $right_now_loop_time || $messages_sent <= 200) {
> proceed to send messages
> $messages_sent++
> update table query to mark message as sent
> }
> else{
> exit(0)
> }

> You should also incorporate a nrow check on the table into the script.
> Once the last stored record(message) is processed(sent) the temp table
> should be dropped & exit the script.
>
> This entire process can of course be done using a file to store the
> messages on the localfile system as well (if db not available).
>
>
>> Yes, there are ways - but the op mentioned nothing about these. And if
>> the script is killed, potentially hundreds of messages could go unsent.
>
> Negative. It's not rocket science. This is not really a problem if one
> takes 25 seconds to think it over. Unfortunately you only gave it a
> couple seconds before you decided that the very easy is impossible.
>
>
>
>
>
Re: Hourly script [message #173330 is a reply to message #173328] Sun, 03 April 2011 18:01 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 4/3/2011 11:12 AM, Mr. B-o-B wrote:
> Jerry Stuckle cried from the depths of the abyss...
>
>> On 4/3/2011 7:03 AM, Luuk wrote:
>>> On 03-04-2011 04:00, Jerry Stuckle wrote:
>>>> And what happens when the script times out? Or it crashes? Or the
>>>> server is rebooted? Or the host kills it because it's been running for
>>>> so long? Or any of a hundred other things which can go wrong?
>>>
>>> The script that actually send a message (an email-message in this case)
>>> should of course mark the message a being send.
>>>
>>> A restart of the script should skipp all messages that already have been
>>> send...
>>>
>>>
>>>
>>
>> And how is it to know? How is it going to keep track of messages?
>
> This is not at all a problem. Assuming the OP has access to mysql(or
> another sql db), or at least the ability to create a table in the db
> then the script should create a temp table to store all the message that
> need to be sent. One of the keys should be something like
> "message_sent". When the script re-runs it should check for the temp
> table, if it exists continue with message sending otherwise (new batch
> of messages ) create a new temp table & populate with the message list.
>
> Then in a nutshell the script will query the temp table
> "SELECT * FROM temp WHERE message_sent <> 'yes'";
>
> Start iteration on the above results.
> After each message is send, update the message record to message_sent =
> 'yes' or however you want to mark it as flagged.
>
> At the start of the script note the time of the script start. Calculate
> endtime +59 minutes from start time. Also set a $messages_sent var to 0.
> Each message should ++ this var. Each iteration should check the time
> first not to exceed 60 minutes or 200 messages sent.
>
> if ($end_time >= $right_now_loop_time || $messages_sent <= 200) {
> proceed to send messages
> $messages_sent++
> update table query to mark message as sent
> }
> else{
> exit(0)
> }
>
> You should also incorporate a nrow check on the table into the script.
> Once the last stored record(message) is processed(sent) the temp table
> should be dropped & exit the script.
>
> This entire process can of course be done using a file to store the
> messages on the localfile system as well (if db not available).
>
>
>> Yes, there are ways - but the op mentioned nothing about these. And if
>> the script is killed, potentially hundreds of messages could go unsent.
>
> Negative. It's not rocket science. This is not really a problem if one
> takes 25 seconds to think it over. Unfortunately you only gave it a
> couple seconds before you decided that the very easy is impossible.
>
>
>
>
>

I didn't say it couldn't be done. However, it's something which has to
be considered, and for a relatively new programmer, is not at all obvious.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Hourly script [message #173331 is a reply to message #173327] Sun, 03 April 2011 18:09 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 4/3/2011 10:22 AM, Mr. B-o-B wrote:
> Jerry Stuckle cried from the depths of the abyss...
>
>> On 4/2/2011 8:18 PM, Mr. B-o-B wrote:
>>> On 4/2/2011 7:09 PM, Jerry Stuckle cried from the depths of the abyss:
>>>> On 4/2/2011 6:18 PM, Mr. B-o-B wrote:
>>>> > On 4/2/2011 3:37 PM, P E Schoen cried from the depths of the abyss:
>>>> >> "Question Boy" wrote in message
>>>> >> news:bc56da6b-df1c-4a56-9789-78fd24c0268d(at)s9g2000yqm(dot)googlegroups(dot)com...
>>>> >>
>>>> >>
>>>> >>
>>>> >>> I built a mailing tool for a custom database for a charity
>>>> >>> organisation and it does work, but our host has a limit of
>>>> >>> 200 e-mails an hour. As it stands, someone has to manually
>>>> >>> send out 200 e-mails every hour until the whole lot is processed
>>>> >>> (2800 recipients and growing). I was simply wondering if there
>>>> >>> is a way to modify/add a bit of code to process the entire
>>>> >>> recordset in batches of 200 records per hour?
>>>> >>
>>>> >> The other responses are probably all you need. The CRON job seems to
>>>> >> require access to the UNIX environment, and I'm not sure how that
>>>> >> might
>>>> >> be done if you are working from a Windows platform. There are many
>>>> >> ways
>>>> >> to do this, but the best way may depend on just how your script is
>>>> >> written. I am assuming it is PHP and is running on either a remote
>>>> >> host
>>>> >> or your localhost Apache server or equivalent.
>>>> >
>>>> > You will need shell access to run a cron locally on the host. If
>>>> > that is
>>>> > not an option, you can use a cron on another *nix box to hit a script
>>>> > that will send 200 messages.
>>>> > lynx -dump /webserver/script.php is a good one.
>>>> >
>>>>
>>>> No you don't. There are webmaster tools which allow you to set up cron
>>>> jobs.
>>>
>>> This is true.
>>>
>>>>
>>>> > This can also be done from a remote windows box as well using
>>>> > scheduled
>>>> > tasks.
>>>> >
>>>>
>>>> Oh gawd - why would you EVER want to do that?
>>>
>>> Despirate times call for despirate measures.
>>>
>>
>> And what happens if your windows box gets shut off? Or the link fails?
>> Or any of a bunch of other things that can happen?
>>
>> It's a terrible suggestion.
>>
>
> I use this trick for various things at work, and have never had a
> problem. Not a terrible idea if you think about it.
>

I had a client who had a forum which sent emails based on cron jobs.
They moved to a host which didn't allow cron jobs and tried your
suggestion. Too many messages got delayed for too long - for instance,
a thunderstorm knocked out power to their office on a Friday evening.
No one was in there to restart the system making the calls until Monday
morning. Meanwhile, all kinds of messages got lost.

It's not bad if you want to do stats; miss a day and it will still
recover the next day. But people who want *reliable* results know
better. And if you don't care about that, why not just host from your
house? It's much cheaper.

>>>>
>>>> > I myself would just program the email script to send 200 messages /
>>>> > wait
>>>> > for the duration of the hour, repeat until all messages are sent.
>>>> >
>>>> >
>>>>
>>>> And exactly how are you going to do that?
>>>
>>> It's fairly easy to time a script, and make it sleep for the difference.
>>>
>>
>> And what happens when the script times out? Or it crashes? Or the
>> server is rebooted? Or the host kills it because it's been running for
>> so long? Or any of a hundred other things which can go wrong?
>>
>> Another bad suggestion, actually.
>>
>
> Cheesit's Rice Man. Get in the game here. One can modify the php.ini
> (max_execution_time) to be 61 minutes. If access to modify php.ini in not
> available one can change this in the script itself using the ini_set
> option so it will not time out.
> Crashes? Then this guy should find a new host. As for the reboot. Who
> cares. If this is setup properly, it will run again at the desired time
> (post reboot) and process the remaining pending messages. It's not a bad
> idea.
>

I am in the game here. First of all, you cannot modify php.ini unless
you have access to the system - in which case you will have no problem
setting up a cron job. And many (most?) shared hosts do not allow the
max_execution_time to be overridden - for very good reason (reliable
hosts won't, at least).

As for crashes - all kinds of things can happen. The script itself can
crash; systems do get rebooted. And how are you going to restart the
script without access to the system?

You show an amazing lack of practical knowledge of how hosting works.



--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Hourly script [message #173332 is a reply to message #173331] Sun, 03 April 2011 19:23 Go to previous messageGo to next message
Mr. B-o-B is currently offline  Mr. B-o-B
Messages: 42
Registered: April 2011
Karma: 0
Member
Jerry Stuckle cried from the depths of the abyss...

> On 4/3/2011 10:22 AM, Mr. B-o-B wrote:
>> Jerry Stuckle cried from the depths of the abyss...
>>
>>> On 4/2/2011 8:18 PM, Mr. B-o-B wrote:
>>>> On 4/2/2011 7:09 PM, Jerry Stuckle cried from the depths of the abyss:
>>>> > On 4/2/2011 6:18 PM, Mr. B-o-B wrote:
>>>> >> On 4/2/2011 3:37 PM, P E Schoen cried from the depths of the abyss:
>>>> >>> "Question Boy" wrote in message
>>>> >>> news:bc56da6b-df1c-4a56-9789-78fd24c0268d(at)s9g2000yqm(dot)googlegroups(dot)com...
>>>> >>>
>>>> >>>
>>>> >>>
>>>> >>>> I built a mailing tool for a custom database for a charity
>>>> >>>> organisation and it does work, but our host has a limit of
>>>> >>>> 200 e-mails an hour. As it stands, someone has to manually
>>>> >>>> send out 200 e-mails every hour until the whole lot is processed
>>>> >>>> (2800 recipients and growing). I was simply wondering if there
>>>> >>>> is a way to modify/add a bit of code to process the entire
>>>> >>>> recordset in batches of 200 records per hour?
>>>> >>>
>>>> >>> The other responses are probably all you need. The CRON job seems to
>>>> >>> require access to the UNIX environment, and I'm not sure how that
>>>> >>> might
>>>> >>> be done if you are working from a Windows platform. There are many
>>>> >>> ways
>>>> >>> to do this, but the best way may depend on just how your script is
>>>> >>> written. I am assuming it is PHP and is running on either a remote
>>>> >>> host
>>>> >>> or your localhost Apache server or equivalent.
>>>> >>
>>>> >> You will need shell access to run a cron locally on the host. If
>>>> >> that is
>>>> >> not an option, you can use a cron on another *nix box to hit a script
>>>> >> that will send 200 messages.
>>>> >> lynx -dump /webserver/script.php is a good one.
>>>> >>
>>>> >
>>>> > No you don't. There are webmaster tools which allow you to set up cron
>>>> > jobs.
>>>>
>>>> This is true.
>>>>
>>>> >
>>>> >> This can also be done from a remote windows box as well using
>>>> >> scheduled
>>>> >> tasks.
>>>> >>
>>>> >
>>>> > Oh gawd - why would you EVER want to do that?
>>>>
>>>> Despirate times call for despirate measures.
>>>>
>>>
>>> And what happens if your windows box gets shut off? Or the link fails?
>>> Or any of a bunch of other things that can happen?
>>>
>>> It's a terrible suggestion.
>>>
>>
>> I use this trick for various things at work, and have never had a
>> problem. Not a terrible idea if you think about it.
>>
>
> I had a client who had a forum which sent emails based on cron jobs. They
> moved to a host which didn't allow cron jobs and tried your suggestion. Too
> many messages got delayed for too long - for instance, a thunderstorm knocked
> out power to their office on a Friday evening. No one was in there to restart
> the system making the calls until Monday morning. Meanwhile, all kinds of
> messages got lost.
>
> It's not bad if you want to do stats; miss a day and it will still recover
> the next day. But people who want *reliable* results know better. And if
> you don't care about that, why not just host from your house? It's much
> cheaper.

Perhaps you failed your client by not suggesting a proper UPS, and a
network monitoring system to notify them that the server was done so it
wouldn't have to wait until Monday.

What is their #, I could use the business.

>
>>>> >
>>>> >> I myself would just program the email script to send 200 messages /
>>>> >> wait
>>>> >> for the duration of the hour, repeat until all messages are sent.
>>>> >>
>>>> >>
>>>> >
>>>> > And exactly how are you going to do that?
>>>>
>>>> It's fairly easy to time a script, and make it sleep for the difference.
>>>>
>>>
>>> And what happens when the script times out? Or it crashes? Or the
>>> server is rebooted? Or the host kills it because it's been running for
>>> so long? Or any of a hundred other things which can go wrong?
>>>
>>> Another bad suggestion, actually.
>>>
>>
>> Cheesit's Rice Man. Get in the game here. One can modify the php.ini
>> (max_execution_time) to be 61 minutes. If access to modify php.ini in not
>> available one can change this in the script itself using the ini_set
>> option so it will not time out.
>> Crashes? Then this guy should find a new host. As for the reboot. Who
>> cares. If this is setup properly, it will run again at the desired time
>> (post reboot) and process the remaining pending messages. It's not a bad
>> idea.
>>
>
> I am in the game here. First of all, you cannot modify php.ini unless you
> have access to the system - in which case you will have no problem setting up
> a cron job. And many (most?) shared hosts do not allow the
> max_execution_time to be overridden - for very good reason (reliable hosts
> won't, at least).
>

Fair enough.

> As for crashes - all kinds of things can happen. The script itself can
> crash; systems do get rebooted. And how are you going to restart the script
> without access to the system?
>
> You show an amazing lack of practical knowledge of how hosting works.
>

I do? I thought I made it clear that a crash, or reboot wouldn't matter
if the script is getting hit hourly.
Re: Hourly script [message #173333 is a reply to message #173332] Sun, 03 April 2011 20:04 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 4/3/2011 3:23 PM, Mr. B-o-B wrote:
> Jerry Stuckle cried from the depths of the abyss...
>
>> On 4/3/2011 10:22 AM, Mr. B-o-B wrote:
>>> Jerry Stuckle cried from the depths of the abyss...
>>>
>>>> On 4/2/2011 8:18 PM, Mr. B-o-B wrote:
>>>> > On 4/2/2011 7:09 PM, Jerry Stuckle cried from the depths of the abyss:
>>>> >> On 4/2/2011 6:18 PM, Mr. B-o-B wrote:
>>>> >>> On 4/2/2011 3:37 PM, P E Schoen cried from the depths of the abyss:
>>>> >>>> "Question Boy" wrote in message
>>>> >>>> news:bc56da6b-df1c-4a56-9789-78fd24c0268d(at)s9g2000yqm(dot)googlegroups(dot)com...
>>>> >>>>
>>>> >>>>
>>>> >>>>
>>>> >>>>
>>>> >>>>> I built a mailing tool for a custom database for a charity
>>>> >>>>> organisation and it does work, but our host has a limit of
>>>> >>>>> 200 e-mails an hour. As it stands, someone has to manually
>>>> >>>>> send out 200 e-mails every hour until the whole lot is processed
>>>> >>>>> (2800 recipients and growing). I was simply wondering if there
>>>> >>>>> is a way to modify/add a bit of code to process the entire
>>>> >>>>> recordset in batches of 200 records per hour?
>>>> >>>>
>>>> >>>> The other responses are probably all you need. The CRON job
>>>> >>>> seems to
>>>> >>>> require access to the UNIX environment, and I'm not sure how that
>>>> >>>> might
>>>> >>>> be done if you are working from a Windows platform. There are many
>>>> >>>> ways
>>>> >>>> to do this, but the best way may depend on just how your script is
>>>> >>>> written. I am assuming it is PHP and is running on either a remote
>>>> >>>> host
>>>> >>>> or your localhost Apache server or equivalent.
>>>> >>>
>>>> >>> You will need shell access to run a cron locally on the host. If
>>>> >>> that is
>>>> >>> not an option, you can use a cron on another *nix box to hit a
>>>> >>> script
>>>> >>> that will send 200 messages.
>>>> >>> lynx -dump /webserver/script.php is a good one.
>>>> >>>
>>>> >>
>>>> >> No you don't. There are webmaster tools which allow you to set up
>>>> >> cron
>>>> >> jobs.
>>>> >
>>>> > This is true.
>>>> >
>>>> >>
>>>> >>> This can also be done from a remote windows box as well using
>>>> >>> scheduled
>>>> >>> tasks.
>>>> >>>
>>>> >>
>>>> >> Oh gawd - why would you EVER want to do that?
>>>> >
>>>> > Despirate times call for despirate measures.
>>>> >
>>>>
>>>> And what happens if your windows box gets shut off? Or the link fails?
>>>> Or any of a bunch of other things that can happen?
>>>>
>>>> It's a terrible suggestion.
>>>>
>>>
>>> I use this trick for various things at work, and have never had a
>>> problem. Not a terrible idea if you think about it.
>>>
>>
>> I had a client who had a forum which sent emails based on cron jobs.
>> They moved to a host which didn't allow cron jobs and tried your
>> suggestion. Too many messages got delayed for too long - for instance,
>> a thunderstorm knocked out power to their office on a Friday evening.
>> No one was in there to restart the system making the calls until
>> Monday morning. Meanwhile, all kinds of messages got lost.
>>
>> It's not bad if you want to do stats; miss a day and it will still
>> recover the next day. But people who want *reliable* results know
>> better. And if you don't care about that, why not just host from your
>> house? It's much cheaper.
>
> Perhaps you failed your client by not suggesting a proper UPS, and a
> network monitoring system to notify them that the server was done so it
> wouldn't have to wait until Monday.
>
> What is their #, I could use the business.
>

Please tell me how a UPS is going to protect against a 6 hour outage.
And adding a networking monitoring system would cost money - it would be
cheaper to go to a good hosting company which does support cron jobs -
which they did.

And even if they did have a network monitoring system, no one was going
to go into the office on the weekend just to power up a machine anyway.

>>
>>>> >>
>>>> >>> I myself would just program the email script to send 200 messages /
>>>> >>> wait
>>>> >>> for the duration of the hour, repeat until all messages are sent.
>>>> >>>
>>>> >>>
>>>> >>
>>>> >> And exactly how are you going to do that?
>>>> >
>>>> > It's fairly easy to time a script, and make it sleep for the
>>>> > difference.
>>>> >
>>>>
>>>> And what happens when the script times out? Or it crashes? Or the
>>>> server is rebooted? Or the host kills it because it's been running for
>>>> so long? Or any of a hundred other things which can go wrong?
>>>>
>>>> Another bad suggestion, actually.
>>>>
>>>
>>> Cheesit's Rice Man. Get in the game here. One can modify the php.ini
>>> (max_execution_time) to be 61 minutes. If access to modify php.ini in
>>> not
>>> available one can change this in the script itself using the ini_set
>>> option so it will not time out.
>>> Crashes? Then this guy should find a new host. As for the reboot. Who
>>> cares. If this is setup properly, it will run again at the desired time
>>> (post reboot) and process the remaining pending messages. It's not a bad
>>> idea.
>>>
>>
>> I am in the game here. First of all, you cannot modify php.ini unless
>> you have access to the system - in which case you will have no problem
>> setting up a cron job. And many (most?) shared hosts do not allow the
>> max_execution_time to be overridden - for very good reason (reliable
>> hosts won't, at least).
>>
>
> Fair enough.
>
>> As for crashes - all kinds of things can happen. The script itself can
>> crash; systems do get rebooted. And how are you going to restart the
>> script without access to the system?
>>
>> You show an amazing lack of practical knowledge of how hosting works.
>>
>
> I do? I thought I made it clear that a crash, or reboot wouldn't matter
> if the script is getting hit hourly.
>
>
>
>

Yes, you do.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Hourly script [message #173334 is a reply to message #173333] Sun, 03 April 2011 23:59 Go to previous messageGo to next message
Mr. B-o-B is currently offline  Mr. B-o-B
Messages: 42
Registered: April 2011
Karma: 0
Member
On 4/3/2011 3:04 PM, Jerry Stuckle cried from the depths of the abyss:

>>
>> I do? I thought I made it clear that a crash, or reboot wouldn't matter
>> if the script is getting hit hourly.
>
> Yes, you do.
>

At the end of the day it does not matter what you think negative Nancy.
Re: Hourly script [message #173335 is a reply to message #173334] Mon, 04 April 2011 00:49 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 4/3/2011 7:59 PM, Mr. B-o-B wrote:
> On 4/3/2011 3:04 PM, Jerry Stuckle cried from the depths of the abyss:
>
>>>
>>> I do? I thought I made it clear that a crash, or reboot wouldn't matter
>>> if the script is getting hit hourly.
>>
>> Yes, you do.
>>
>
> At the end of the day it does not matter what you think negative Nancy.

No, but it DOES matter that your clients have such an incompetent person
managing their data.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Hourly script [message #173336 is a reply to message #173334] Mon, 04 April 2011 00:50 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 4/3/2011 7:59 PM, Mr. B-o-B wrote:
> On 4/3/2011 3:04 PM, Jerry Stuckle cried from the depths of the abyss:
>
>>>
>>> I do? I thought I made it clear that a crash, or reboot wouldn't matter
>>> if the script is getting hit hourly.
>>
>> Yes, you do.
>>
>
> At the end of the day it does not matter what you think negative Nancy.

Oh, and BTW - I see you have no intelligent response, so you have to
resort to third-grade name calling.

How mature. NOT!

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Hourly script [message #173337 is a reply to message #173335] Mon, 04 April 2011 00:55 Go to previous messageGo to next message
Mr. B-o-B is currently offline  Mr. B-o-B
Messages: 42
Registered: April 2011
Karma: 0
Member
On 4/3/2011 7:49 PM, Jerry Stuckle cried from the depths of the abyss:
> On 4/3/2011 7:59 PM, Mr. B-o-B wrote:
>> On 4/3/2011 3:04 PM, Jerry Stuckle cried from the depths of the abyss:
>>
>>>>
>>>> I do? I thought I made it clear that a crash, or reboot wouldn't matter
>>>> if the script is getting hit hourly.
>>>
>>> Yes, you do.
>>>
>>
>> At the end of the day it does not matter what you think negative Nancy.
>
> No, but it DOES matter that your clients have such an incompetent person
> managing their data.
>

Good One
Re: Hourly script [message #173338 is a reply to message #173336] Mon, 04 April 2011 00:56 Go to previous messageGo to next message
Mr. B-o-B is currently offline  Mr. B-o-B
Messages: 42
Registered: April 2011
Karma: 0
Member
On 4/3/2011 7:50 PM, Jerry Stuckle cried from the depths of the abyss:
> On 4/3/2011 7:59 PM, Mr. B-o-B wrote:
>> On 4/3/2011 3:04 PM, Jerry Stuckle cried from the depths of the abyss:
>>
>>>>
>>>> I do? I thought I made it clear that a crash, or reboot wouldn't matter
>>>> if the script is getting hit hourly.
>>>
>>> Yes, you do.
>>>
>>
>> At the end of the day it does not matter what you think negative Nancy.
>
> Oh, and BTW - I see you have no intelligent response, so you have to
> resort to third-grade name calling.
>
> How mature. NOT!
>

It's just the truth.
Re: Hourly script [message #173339 is a reply to message #173335] Mon, 04 April 2011 00:57 Go to previous messageGo to next message
Mr. B-o-B is currently offline  Mr. B-o-B
Messages: 42
Registered: April 2011
Karma: 0
Member
On 4/3/2011 7:49 PM, Jerry Stuckle cried from the depths of the abyss:
> On 4/3/2011 7:59 PM, Mr. B-o-B wrote:
>> On 4/3/2011 3:04 PM, Jerry Stuckle cried from the depths of the abyss:
>>
>>>>
>>>> I do? I thought I made it clear that a crash, or reboot wouldn't matter
>>>> if the script is getting hit hourly.
>>>
>>> Yes, you do.
>>>
>>
>> At the end of the day it does not matter what you think negative Nancy.
>
> No, but it DOES matter that your clients have such an incompetent person
> managing their data.
>

I believe it was I was offered several valid examples. Anyways,...
Re: Hourly script [message #173342 is a reply to message #173338] Mon, 04 April 2011 01:51 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 4/3/2011 8:56 PM, Mr. B-o-B wrote:
> On 4/3/2011 7:50 PM, Jerry Stuckle cried from the depths of the abyss:
>> On 4/3/2011 7:59 PM, Mr. B-o-B wrote:
>>> On 4/3/2011 3:04 PM, Jerry Stuckle cried from the depths of the abyss:
>>>
>>>> >
>>>> > I do? I thought I made it clear that a crash, or reboot wouldn't
>>>> > matter
>>>> > if the script is getting hit hourly.
>>>>
>>>> Yes, you do.
>>>>
>>>
>>> At the end of the day it does not matter what you think negative Nancy.
>>
>> Oh, and BTW - I see you have no intelligent response, so you have to
>> resort to third-grade name calling.
>>
>> How mature. NOT!
>>
>
> It's just the truth.

Yea, just like all trolls. Run out of logical arguments, so you have to
start calling people names, just like a third grader. Then claim "it's
the truth".

ROFLMAO!

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Hourly script [message #173351 is a reply to message #173308] Mon, 04 April 2011 13:43 Go to previous message
Captain Paralytic is currently offline  Captain Paralytic
Messages: 204
Registered: September 2010
Karma: 0
Senior Member
On Apr 3, 12:56 am, Question Boy <question....@hotmail.com> wrote:
> On Apr 2, 7:18 pm, Jim Higgins <inva...@invalid.invalid> wrote:
>
>> On Sat, 2 Apr 2011 10:38:48 -0700 (PDT), Question Boy
>
>> <question....@hotmail.com> wrote:
>>> I built a mailing tool for a custom database for a charity
>>> organisation and it does work, but our host has a limit of 200 e-mails
>>> an hour.  As it stands, someone has to manually send out 200 e-mails
>>> every hour until the whole lot is processed (2800 recipients and
>>> growing).  I was simply wondering if there is a way to modify/add a
>>> bit of code to process the entire recordset in batches of 200 records
>>> per hour?
>
>>> Any help would be truly appreciated.
>
>> If I were you I'd give priority to getting the 200 emails per hour
>> limit lifted.
>
> The host will not change this and I have been unable to convince the
> charity to move to another host.  So it looks like I will seriously
> look into one of the other proposed solutions.
>
> Thank you all for the advice!
>
> QB

What's wrong with Mr. B-O-B's suggestion of using an unlimited SMTP
server or even sending through MailChimp.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Stats comp.lang.php (last 7 days)
Next Topic: Firefox PHP error report
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 08:16:33 GMT 2024

Total time taken to generate the page: 0.02707 seconds