By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,643 Members | 1,797 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,643 IT Pros & Developers. It's quick & easy.

Automated tasks

P: n/a
Hi,

I have an auction site running. Now I want the auction to be able to
automatically send a mail msg to the seller after it expires. How do I do
it? Obviously there is some sort of way that I can employ so that this task
does not require an operator (such as me) to run manually. This task will
involve accessing the database and sending an email. Can somebody enlighten
me on this?

==James==
Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
You could run a PHP script from a cron task and verify if there are
mails to be sent. It wouldn't be sent at the exact second but I do think
it's the best solution. You could include a verification in your scripts
but running that every load is quite useless and takes CPU time off
your server.

L'Angel Admirable wrote:
Hi,

I have an auction site running. Now I want the auction to be able to
automatically send a mail msg to the seller after it expires. How do I do
it? Obviously there is some sort of way that I can employ so that this task
does not require an operator (such as me) to run manually. This task will
involve accessing the database and sending an email. Can somebody enlighten
me on this?

==James==


Jul 17 '05 #2

P: n/a

"L'Angel Admirable" <ja*******@paradise.net.nz> wrote in message
news:9e******************@news02.tsnz.net...
Hi,

I have an auction site running. Now I want the auction to be able to
automatically send a mail msg to the seller after it expires. How do I do
it? Obviously there is some sort of way that I can employ so that this task does not require an operator (such as me) to run manually. This task will
involve accessing the database and sending an email. Can somebody enlighten me on this?

==James==


PHP does not have a job scheduler so the short answer is no, you can't do
this reliably using PHP alone.

The long answer is that you could have an external schedular, like
Unix/Linux cron that could call and activate your script... Alternativly,
you could have some check that when ever anyone visits your site, it checks
cloesd auctions and creates the mailers... but this would mean that the
email activity would only be acivated (unknowingly) by a visitor - thus a
server with a period of inactivity would not send the mailers... It really
wouldn't be reliable and could give mixed if implemented badly (ie two folk
visiting at the same time initiating two checks on the same auctions
resulting in two or more emails being sent out with the same notification
messages contained - or a timeout occuring before the scripts have properly
completed).

Your best bet would be an external schedular, like cron.
Jul 17 '05 #3

P: n/a
Thanks.. Randell, I am just wondering where do the cron configuration files
reside on a redhat system, so that I can schedule some sort of tasks?

==James==

"Randell D." <yo**************************@yahoo.com> wrote in message
news:cf%ob.254615$9l5.132086@pd7tw2no...

"L'Angel Admirable" <ja*******@paradise.net.nz> wrote in message
news:9e******************@news02.tsnz.net...
Hi,

I have an auction site running. Now I want the auction to be able to
automatically send a mail msg to the seller after it expires. How do I do it? Obviously there is some sort of way that I can employ so that this task
does not require an operator (such as me) to run manually. This task will involve accessing the database and sending an email. Can somebody

enlighten
me on this?

==James==


PHP does not have a job scheduler so the short answer is no, you can't do
this reliably using PHP alone.

The long answer is that you could have an external schedular, like
Unix/Linux cron that could call and activate your script... Alternativly,
you could have some check that when ever anyone visits your site, it

checks cloesd auctions and creates the mailers... but this would mean that the
email activity would only be acivated (unknowingly) by a visitor - thus a
server with a period of inactivity would not send the mailers... It really
wouldn't be reliable and could give mixed if implemented badly (ie two folk visiting at the same time initiating two checks on the same auctions
resulting in two or more emails being sent out with the same notification
messages contained - or a timeout occuring before the scripts have properly completed).

Your best bet would be an external schedular, like cron.

Jul 17 '05 #4

P: n/a
On Mon, 03 Nov 2003 03:28:32 GMT, "Randell D."
<yo**************************@yahoo.com> wrote:
$ man 5 cron

or

$ man 5 crontab

To understand the layout - however, if you have a rough idea on cron, then
do

# crontab -e

This will edit your existing crontab setup - Note, if you are not a root
user, you must have root privilages (there is a file called cron.allow that
would have usernames listed of those who do have cron access - secondly,
becareful on how you write your scripts because they will be executed with
'root' access - You could easily write a script to remove every file on the
system... so check and double check your code).


Not sure about how Redhat sets this up, but it's quite normal for normal users
to have cron access. Their jobs do NOT get run as root - that'd be a nightmare!
They get run as the owner of the crontab entry.

--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.