LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-31-2004, 12:14 PM   #1
leosuth
LQ Newbie
 
Registered: May 2004
Posts: 3

Rep: Reputation: 0
Wink executing a time-triggered script


I have a customer whose website is hosted on a Linx machine running Apache, generated from a MySQL database using PHP ASP. My requirement is:

Users fill info into a form, which when submitted is loaded by PHP into a table in the MySQL database. OK so far. What I need is a way of notifying the customer that there is new info in the table (info from possibly several users)

What I envisage is a process running o the Linux machine that every 15 minutes, say, kicks a PHP script into action. This PHP script would then query the MySQL database to look for new information, and then, if new info is found, send an email to the customer to notify them.

How can this be done? Can Apache be setup to kick a PHP script at regular intervals? Please help, I'm fairly new at PHP and Linux.
 
Old 05-31-2004, 01:51 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
Welcome to LQ.

Take a look at the crontab man page. It will show you how to create scheduled tasks.
 
Old 06-01-2004, 03:49 AM   #3
leosuth
LQ Newbie
 
Registered: May 2004
Posts: 3

Original Poster
Rep: Reputation: 0
Ta.

Unfortunately, I haen't got a Linux or UNIX machine - so no crontab.

I am aware of cron and crontab - that was how I was going to kick my process off. What I wanted to know is if it is possible to kick a PHP script just by putting 'script.php' into the appropriate place in the cron table?
 
Old 06-01-2004, 04:10 AM   #4
Kp2Sushi
LQ Newbie
 
Registered: Feb 2004
Location: Salem, Oregon
Distribution: Debian Unstable
Posts: 2

Rep: Reputation: 0
In perl I'd do this

If you have a perl installation installed you can do this:
Code:
#!/path-to-perl/perl -w

$sleep_interval = 15 * 60

for(;;)
{
    sleep $sleep_interval;
     `command ;
}
There ya go, your very own scheduled executor.
 
Old 06-01-2004, 05:57 AM   #5
itsme86
Senior Member
 
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 59
The command would be: php script.php
 
Old 06-01-2004, 02:12 PM   #6
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
Re: executing a time-triggered script

Quote:
Originally posted by leosuth
I have a customer whose website is hosted on a Linx machine running Apache, generated from a MySQL database using PHP ASP.
Quote:
Originally posted by leosuth
Unfortunately, I haen't got a Linux or UNIX machine - so no crontab.
So do you or do you not use a linux box? Does this have anything to do with linux or is it just an open source question?
 
Old 06-01-2004, 03:10 PM   #7
leosuth
LQ Newbie
 
Registered: May 2004
Posts: 3

Original Poster
Rep: Reputation: 0
I don't, but my customer does - and since I am not too familiar with Linux, this is where I came for help. Speaking of which, thanks to everyone for their help - question answered.
 
Old 06-02-2004, 08:15 AM   #8
deiussum
Member
 
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895

Rep: Reputation: 32
Put the crontab entry on the customer's computer.
 
  


Reply



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 On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
executing a script!! vishamr2000 Linux - Security 5 07-29-2005 02:34 AM
Executing install script for ... securehack Linux - Software 6 05-24-2005 11:02 AM
executing a command at a certain time pantera Programming 6 04-05-2005 12:22 PM
Executing iptables script dat64597 Linux - Security 1 02-09-2003 07:02 PM
executing a shell script from C llama_meme Programming 2 04-01-2002 09:10 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration