Connecting Tech Pros Worldwide Forums | Help | Site Map

Automated Server Scripts at Intervals

enko
Guest
 
Posts: n/a
#1: Mar 3 '06
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.


NC
Guest
 
Posts: n/a
#2: Mar 3 '06

re: Automated Server Scripts at Intervals


enko wrote:[color=blue]
>
> 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?[/color]

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

Jonathan Wiltshire
Guest
 
Posts: n/a
#3: Mar 3 '06

re: Automated Server Scripts at Intervals



"enko" <mbyrd1332@gmail.com> wrote in message
news:1141409357.429781.247610@e56g2000cwe.googlegr oups.com...[color=blue]
> 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.[/color]

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


d
Guest
 
Posts: n/a
#4: Mar 3 '06

re: Automated Server Scripts at Intervals


"Jonathan Wiltshire" <news@jwiltshire.org.uk> wrote in message
news:AS1Of.70291$m13.60862@newsfe5-gui.ntli.net...[color=blue]
>
> "enko" <mbyrd1332@gmail.com> wrote in message
> news:1141409357.429781.247610@e56g2000cwe.googlegr oups.com...[color=green]
>> 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.[/color]
>
> 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.[/color]

Provided the new server is with them :-P
[color=blue]
> Jon
>[/color]


Jonathan Wiltshire
Guest
 
Posts: n/a
#5: Mar 3 '06

re: Automated Server Scripts at Intervals



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

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


Andy Jeffries
Guest
 
Posts: n/a
#6: Mar 5 '06

re: Automated Server Scripts at Intervals


On Fri, 03 Mar 2006 21:15:15 +0000, d wrote:[color=blue][color=green][color=darkred]
>>> 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.[/color]
>>
>> 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.[/color]
>
> Provided the new server is with them :-P[/color]

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

Jonathan Wiltshire
Guest
 
Posts: n/a
#7: Mar 5 '06

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...[color=blue]
>
> 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 :-)
>[/color]

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

J


google@impliedbydesign.com
Guest
 
Posts: n/a
#8: Mar 5 '06

re: Automated Server Scripts at Intervals



enko wrote:[color=blue]
> 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.[/color]

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

Closed Thread