Automated Server Scripts at Intervals

This is a discussion on Automated Server Scripts at Intervals within the PHP Language forums, part of the PHP Programming Forums category; Our company has developed a web-app that needs the ability to run a regular maintenance PHP script and use ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-03-2006
enko
 
Posts: n/a
Default Automated Server Scripts at Intervals

Our company has developed a web-app that needs the ability to run a
regular maintenance PHP script and use it also send out SMS/Email
alerts on a regular basis, say at exactly 9AM and 2PM without user
interaction. We're using shared hosting at the moment, so we have no
access anything more than our file directory on the server and our
database. To resolve this I've created a small vb.net app that accesses
the maintenance script on our server at the preset times, which sends
out the email and everything as it should. This is functional for now
but I see this as a short-term solution considering the possible
unreliability of running an app outside of the server on a home/office
computer, also the possible security risks involved. I was wondering if
anyone knew of a better solution. We're going to be upgrading to a
dedicated server within a few months and surely there is a way for the
server to automatically run a php script at regular intervals? Maybe
I'm just looking for the most difficult solution, but any help would be
appreciated.

Reply With Quote
  #2 (permalink)  
Old 03-03-2006
NC
 
Posts: n/a
Default Re: Automated Server Scripts at Intervals

enko wrote:
>
> Our company has developed a web-app that needs the ability to run a
> regular maintenance PHP script and use it also send out SMS/Email
> alerts on a regular basis, say at exactly 9AM and 2PM without user
> interaction. We're using shared hosting at the moment, so we have no
> access anything more than our file directory on the server and our
> database. To resolve this I've created a small vb.net app that accesses
> the maintenance script on our server at the preset times, which sends
> out the email and everything as it should. This is functional for now
> but I see this as a short-term solution considering the possible
> unreliability of running an app outside of the server on a home/office
> computer, also the possible security risks involved. I was wondering if
> anyone knew of a better solution. We're going to be upgrading to a
> dedicated server within a few months and surely there is a way for the
> server to automatically run a php script at regular intervals?


Since you are upgrading to a dedicated server, I think the problem is
not worth solving now. Just make sure you take appropriate precautions
against accidentally running the maintenance script too often (have the
script keep a log of its activity and do nothing unless it's time for
the next run).

Also, when you do upgrade, it's probably a good idea to run your script
from the command line...

Cheers,
NC

Reply With Quote
  #3 (permalink)  
Old 03-03-2006
Jonathan Wiltshire
 
Posts: n/a
Default Re: Automated Server Scripts at Intervals


"enko" <mbyrd1332@gmail.com> wrote in message
news:1141409357.429781.247610@e56g2000cwe.googlegr oups.com...
> We're going to be upgrading to a
> dedicated server within a few months and surely there is a way for the
> server to automatically run a php script at regular intervals? Maybe
> I'm just looking for the most difficult solution, but any help would be
> appreciated.


Once you've got your dedicated server, the daemon you want it called crond
if it's
Linux, or the Task Scheduler if it's Windows. Either way, you need to call
'php myscript.php'.
However, make sure your script doesn't expect to use Apache/IIS-specific
stuff, or
PHP will bail out.

If you speak very nicely with your hosts, they might set this up for you
temporarily now,
on the grounds that you're going to upgrade to a dedicated server soon
anyway.

Jon


Reply With Quote
  #4 (permalink)  
Old 03-03-2006
d
 
Posts: n/a
Default Re: Automated Server Scripts at Intervals

"Jonathan Wiltshire" <news@jwiltshire.org.uk> wrote in message
news:AS1Of.70291$m13.60862@newsfe5-gui.ntli.net...
>
> "enko" <mbyrd1332@gmail.com> wrote in message
> news:1141409357.429781.247610@e56g2000cwe.googlegr oups.com...
>> We're going to be upgrading to a
>> dedicated server within a few months and surely there is a way for the
>> server to automatically run a php script at regular intervals? Maybe
>> I'm just looking for the most difficult solution, but any help would be
>> appreciated.

>
> Once you've got your dedicated server, the daemon you want it called crond
> if it's
> Linux, or the Task Scheduler if it's Windows. Either way, you need to call
> 'php myscript.php'.
> However, make sure your script doesn't expect to use Apache/IIS-specific
> stuff, or
> PHP will bail out.
>
> If you speak very nicely with your hosts, they might set this up for you
> temporarily now,
> on the grounds that you're going to upgrade to a dedicated server soon
> anyway.


Provided the new server is with them :-P

> Jon
>



Reply With Quote
  #5 (permalink)  
Old 03-03-2006
Jonathan Wiltshire
 
Posts: n/a
Default Re: Automated Server Scripts at Intervals


"d" <d@example.com> wrote in message
news:Dl2Of.29703$wl.15950@text.news.blueyonder.co. uk...
>
> Provided the new server is with them :-P
>


Well, yeh, there is that.. ;-)


Reply With Quote
  #6 (permalink)  
Old 03-05-2006
Andy Jeffries
 
Posts: n/a
Default Re: Automated Server Scripts at Intervals

On Fri, 03 Mar 2006 21:15:15 +0000, d wrote:
>>> We're going to be upgrading to a
>>> dedicated server within a few months and surely there is a way for the
>>> server to automatically run a php script at regular intervals? Maybe
>>> I'm just looking for the most difficult solution, but any help would be
>>> appreciated.

>>
>> Once you've got your dedicated server, the daemon you want it called
>> crond if it's
>> Linux, or the Task Scheduler if it's Windows. Either way, you need to
>> call 'php myscript.php'.
>> However, make sure your script doesn't expect to use Apache/IIS-specific
>> stuff, or
>> PHP will bail out.
>>
>> If you speak very nicely with your hosts, they might set this up for you
>> temporarily now,
>> on the grounds that you're going to upgrade to a dedicated server soon
>> anyway.

>
> Provided the new server is with them :-P


But most hosts would do it now on the fact the client says "we're going to
be going dedicated in 3 months and will be considering your company for
that, in the meantime would you....."

It may help if you get a sexy-sounding lady to call for you :-)

Cheers,


Andy


--
Andy Jeffries | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos

Reply With Quote
  #7 (permalink)  
Old 03-05-2006
Jonathan Wiltshire
 
Posts: n/a
Default Re: Automated Server Scripts at Intervals


"Andy Jeffries" <news@andyjeffries.co.uk> wrote in message
news:pan.2006.03.05.10.43.37.455006@andyjeffries.c o.uk...
>
> But most hosts would do it now on the fact the client says "we're going to
> be going dedicated in 3 months and will be considering your company for
> that, in the meantime would you....."
>
> It may help if you get a sexy-sounding lady to call for you :-)
>


Exactly. They'll probably be a lot more helpful if they think you'll go
dedicated with them.

J


Reply With Quote
  #8 (permalink)  
Old 03-05-2006
google@impliedbydesign.com
 
Posts: n/a
Default Re: Automated Server Scripts at Intervals


enko wrote:
> We're going to be upgrading to a
> dedicated server within a few months and surely there is a way for the
> server to automatically run a php script at regular intervals? Maybe
> I'm just looking for the most difficult solution, but any help would be
> appreciated.


Hello,

I've only had to deal with doing this on a shared hosting, so the
solution might be different than on your dedicated host, but you can
set up something called a cron job, which will run a script at a
particular time, or interval. I use a simple interface, through my
host's control panel, but you can also program cron jobs through the
command line.

Chris S.

Free Web Design Tools
http://www.impliedbydesign.com/free-...e-scripts.html

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 12:08 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0