Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 07-05-2005, 04:37 AM PHP Cronjobs
fambi's Avatar
Ultra Talker

Posts: 339
Trades: 0
Hi everyone - it's been some time since i post - hope all is well.

Is it possible to allow a user to set a cron job in PHP?

At the moment, the only way i know how to set a cron-job is to access the C-Panel provided by our host.

So is it possible to do something like this in PHP - my thoughts so far is to have a table which has a timestamp column. When the script is run, it checks if there are any jobs awaiting and processes them.

But how do you get this script to run every minute without upsetting the host?

Your experience is in this field is greatly appreciated.
__________________

Please login or register to view this content. Registration is FREE
from a
Please login or register to view this content. Registration is FREE
is easy!
Read this
Please login or register to view this content. Registration is FREE
that uses our
Please login or register to view this content. Registration is FREE
.
fambi is offline
Reply With Quote
View Public Profile Visit fambi's homepage!
 
 
Register now for full access!
Old 07-06-2005, 06:55 AM
leavethisplace's Avatar
Ultra Talker

Posts: 297
Trades: 0
in simple 2 letter terms, "no" - there is no way to do this, because executing the PHP over and over (looping it) will cause it to timeout anyway, and yes, it would annoy your host! Have you thought about just getting the Cron to execute the script very, say, 10 minutes - this wouldnt upset your server, but may zap your bandwidth a little!
__________________
A lie gets halfway around the world before the truth has a chance to get its pants on. - Sir Winston Churchill

Please visit my sites:
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
leavethisplace is offline
Reply With Quote
View Public Profile
 
Old 07-06-2005, 06:58 AM
fambi's Avatar
Ultra Talker

Posts: 339
Trades: 0
I am feeling the same way. Thanks.
__________________

Please login or register to view this content. Registration is FREE
from a
Please login or register to view this content. Registration is FREE
is easy!
Read this
Please login or register to view this content. Registration is FREE
that uses our
Please login or register to view this content. Registration is FREE
.
fambi is offline
Reply With Quote
View Public Profile Visit fambi's homepage!
 
Old 07-08-2005, 05:30 AM
Novice Talker

Posts: 8
Trades: 0
Of couse it's possible. I've done it several times.

1) Create a php file that fetches the data from the table and performs the desired work. Test it first via web and see if everything is fine, once you achive the desired result put it in the cron job in 1 minute

2) /usr/bin/php /home/-your-cpanel-login/public_html/location_of_the_file.php

It will do the work, if for some reason it causes load balance the sysadmin will tell you and you will change let's say form 1 minute to every 30 minutes.

But that should be a problem
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
andrade is offline
Reply With Quote
View Public Profile
 
Old 07-09-2005, 01:12 PM
Jacky's Avatar
Novice Talker

Posts: 14
Trades: 0
Quote:
Originally Posted by andrade
Of couse it's possible. I've done it several times.

1) Create a php file that fetches the data from the table and performs the desired work. Test it first via web and see if everything is fine, once you achive the desired result put it in the cron job in 1 minute

2) /usr/bin/php /home/-your-cpanel-login/public_html/location_of_the_file.php
I think what fambi wants to do is to have everything in PHP - not using the system's cron jobs. This may not be possible at all.... how would you schedule a php script to execute without cron jobs?
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Jacky is offline
Reply With Quote
View Public Profile Visit Jacky's homepage!
 
Old 07-09-2005, 08:41 PM
leavethisplace's Avatar
Ultra Talker

Posts: 297
Trades: 0
as far as i know, it's impossible - unless of course you have your own dedicated server, in which case i believe you can get the server to execute certain programs for you, such as a php script - other than this it is impossible because the server itself has to call on the PHP script itself. As i said before, executing a PHP over and over will only cause a time out - cron jobs are supplied courtesy of any good provider!
__________________
A lie gets halfway around the world before the truth has a chance to get its pants on. - Sir Winston Churchill

Please visit my sites:
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
leavethisplace is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to PHP Cronjobs
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.30217 seconds with 12 queries