Re: Hourly script [message #173333 is a reply to message #173332] |
Sun, 03 April 2011 20:04 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma:
|
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
==================
|
|
|