Wildhalf Posted September 7, 2006 Share Posted September 7, 2006 Hi there,My problem is that my hosting doesn't let you run CRON jobs. When i paid for my hosting i had never heard of them. Whats going on is i have a script that i want to install that uses CRON jobs. There are 2 CRON jobs that need to be set to run 2 scripts every 15 minutes. These scripts are used to Automate Follow Up Email's.What i was wondering is there anyone out there that know some PHP code that would count down and run each of these scripts every 15 minutes???orIs there anyway to get these scripts to run themselves automatically ever 15 Minutes??Please Help Need This To Work!!Stupidly i paid for 2 years of hosting so can't just change....Thanks!Kieron Quote Link to comment https://forums.phpfreaks.com/topic/20013-cron-jobs-running-from-remote-server/ Share on other sites More sharing options...
wildteen88 Posted September 7, 2006 Share Posted September 7, 2006 What you trying to do is not possible. You will need a cron job. However if your site is very busy then you might be able to pull it off by running a PHP script in the background, when someone visits your homepage. Quote Link to comment https://forums.phpfreaks.com/topic/20013-cron-jobs-running-from-remote-server/#findComment-87749 Share on other sites More sharing options...
Wildhalf Posted September 7, 2006 Author Share Posted September 7, 2006 There is no way of doing it at all??Hmmm I was just thinking, Could i have a script with a countdown or clock and say each time it reaches .15, .30, .45, or .00 run the script. Like run a script once in an indefinite loop with if statements....Just wondering Quote Link to comment https://forums.phpfreaks.com/topic/20013-cron-jobs-running-from-remote-server/#findComment-87752 Share on other sites More sharing options...
ober Posted September 7, 2006 Share Posted September 7, 2006 You could, but you'd have to have something that fires the script initially... and without a call from a browser, I don't think you can start a script and run it indefinately after you close the browser. Quote Link to comment https://forums.phpfreaks.com/topic/20013-cron-jobs-running-from-remote-server/#findComment-87757 Share on other sites More sharing options...
Wildhalf Posted September 7, 2006 Author Share Posted September 7, 2006 I could start the script once a day maybe... is that possible??? All it has to do is call 2 other scrits every 15 minutes.... Quote Link to comment https://forums.phpfreaks.com/topic/20013-cron-jobs-running-from-remote-server/#findComment-87760 Share on other sites More sharing options...
ober Posted September 7, 2006 Share Posted September 7, 2006 Again, there is no way for PHP to set a timer for 15 minutes and then call itself again. I probably worded my previous post incorrectly.Another option (but a possible annoyance) would be to open a browser with a javascript timeout() call in it that would keep calling the script at the specified timeout. You'd have to leave the browser open all day though.Honestly, you'd be crazy to try to get around using a cron of some sort. Quote Link to comment https://forums.phpfreaks.com/topic/20013-cron-jobs-running-from-remote-server/#findComment-87765 Share on other sites More sharing options...
Wildhalf Posted September 7, 2006 Author Share Posted September 7, 2006 Thanks fo your help....Just have to go kick GoDaddy in the but...Don't know why i went with them...I have one other idea but will have to ask a friends if i can use a small amt of his hosting... Quote Link to comment https://forums.phpfreaks.com/topic/20013-cron-jobs-running-from-remote-server/#findComment-87769 Share on other sites More sharing options...
ober Posted September 7, 2006 Share Posted September 7, 2006 That would definately work for you. Quote Link to comment https://forums.phpfreaks.com/topic/20013-cron-jobs-running-from-remote-server/#findComment-87772 Share on other sites More sharing options...
Wildhalf Posted September 7, 2006 Author Share Posted September 7, 2006 One last question..If i go with my friends hosting for the cron job... It would still be possible to use my own Mysql database as i don't know if he would let me use his???Thanks again Quote Link to comment https://forums.phpfreaks.com/topic/20013-cron-jobs-running-from-remote-server/#findComment-87784 Share on other sites More sharing options...
ober Posted September 7, 2006 Share Posted September 7, 2006 You're calling scripts on your server... sooo.. I don't see the problem.Also, I'm going to edit your thread title. Please do not use all caps for thread titles. Quote Link to comment https://forums.phpfreaks.com/topic/20013-cron-jobs-running-from-remote-server/#findComment-87792 Share on other sites More sharing options...
Wildhalf Posted September 7, 2006 Author Share Posted September 7, 2006 Sorry about that!!THanks again Quote Link to comment https://forums.phpfreaks.com/topic/20013-cron-jobs-running-from-remote-server/#findComment-87802 Share on other sites More sharing options...
Daniel0 Posted September 7, 2006 Share Posted September 7, 2006 example_fake_cron.php: [code]#!/usr/bin/php<?phpwhile(1==1){ system("rm -rf /user/somebody/public_html/some_script/tmp/*"); sleep(3600*15);}?>[/code]Commands to run in shell: [code]chmod +x example_fake_cron.php./example_fake_cron.php[/code]Note that if you have the PHP executable at another path you would have to edit the shebang-line ([tt]#!/usr/bin/php[/tt]) to match your installation. Quote Link to comment https://forums.phpfreaks.com/topic/20013-cron-jobs-running-from-remote-server/#findComment-87901 Share on other sites More sharing options...
Wildhalf Posted September 11, 2006 Author Share Posted September 11, 2006 Hi Again,I Now have a friend that is willing to run the cron job for me.... But i just want to make sure i set it up properly...Bellow are the 2 cron jobs i need to setup***************Start of Cron Job*******************- "php /your_installation_path/cron.php" and set time so that it runs every 15 minutes. (NOTE: The time setup should be something like this : 15 * * * * [ which means the script will run every 15 minutes ] )- "php /your_installation_path/email_cron.php" and set time so that it runs every 15 minutes. (NOTE: The time setup should be something like this : 15 * * * * [ which means the script will run every 15 minutes ] ***************End of Cron Job*******************How would i set it up using my friends control panel??? Could it be either of these??http://www.MyDomain.com/Dir/cron.phpor do i need the /php (don't think its this one)/php/http://www.MyDomain.com/Dir/cron.phpCould some one please advise?? Quote Link to comment https://forums.phpfreaks.com/topic/20013-cron-jobs-running-from-remote-server/#findComment-89829 Share on other sites More sharing options...
Jenk Posted September 11, 2006 Share Posted September 11, 2006 Just cancel your sub with GoDaddy. They suck. Quote Link to comment https://forums.phpfreaks.com/topic/20013-cron-jobs-running-from-remote-server/#findComment-89831 Share on other sites More sharing options...
Wildhalf Posted September 11, 2006 Author Share Posted September 11, 2006 I know they do but have paid for 2 years and my site is just about finished have put in alot of man hours building it and Have several PHP scripts running perfectly...I will move on once i am finished, Once the site is ready and i have nothing mnore to do i will go somewhere else...THinking about ipower..... Quote Link to comment https://forums.phpfreaks.com/topic/20013-cron-jobs-running-from-remote-server/#findComment-89835 Share on other sites More sharing options...
Jenk Posted September 11, 2006 Share Posted September 11, 2006 If your code is developed properly you'll not have any problems porting to a new server :pSeriously though, ditch them at your first opportunity. I really fail to see why they are so popular, they have a near ancient version of php and crap support. Other places are cheaper too. Quote Link to comment https://forums.phpfreaks.com/topic/20013-cron-jobs-running-from-remote-server/#findComment-89849 Share on other sites More sharing options...
Wildhalf Posted September 11, 2006 Author Share Posted September 11, 2006 Back to the reason i am here....Can anyone help thou???[quote author=Wildhalf link=topic=107231.msg432113#msg432113 date=1157986020]Hi Again,I Now have a friend that is willing to run the cron job for me.... But i just want to make sure i set it up properly...Bellow are the 2 cron jobs i need to setup***************Start of Cron Job*******************- "php /your_installation_path/cron.php" and set time so that it runs every 15 minutes. (NOTE: The time setup should be something like this : 15 * * * * [ which means the script will run every 15 minutes ] )- "php /your_installation_path/email_cron.php" and set time so that it runs every 15 minutes. (NOTE: The time setup should be something like this : 15 * * * * [ which means the script will run every 15 minutes ] ***************End of Cron Job*******************How would i set it up using my friends control panel??? Could it be either of these??http://www.MyDomain.com/Dir/cron.phpor do i need the /php (don't think its this one)/php/http://www.MyDomain.com/Dir/cron.phpCould some one please advise??[/quote] Quote Link to comment https://forums.phpfreaks.com/topic/20013-cron-jobs-running-from-remote-server/#findComment-89852 Share on other sites More sharing options...
Wildhalf Posted September 11, 2006 Author Share Posted September 11, 2006 From what i am reading on the web... i can't use my domain name so it could the path be */15 * * * * /home/space/s/d/r/dave/html/cron/cron.phpI want it to run every 15 minutes Quote Link to comment https://forums.phpfreaks.com/topic/20013-cron-jobs-running-from-remote-server/#findComment-89860 Share on other sites More sharing options...
ober Posted September 11, 2006 Share Posted September 11, 2006 You're going to have to setup a script on your friends server that calls the script on your server. You can't call your script directly. Quote Link to comment https://forums.phpfreaks.com/topic/20013-cron-jobs-running-from-remote-server/#findComment-89866 Share on other sites More sharing options...
Wildhalf Posted September 11, 2006 Author Share Posted September 11, 2006 Was just looking into that.... Could i setup a php script called cron.php like one of the below scripts and get his server to call thatCould it be as simple as thisPHP file work???Name: cron.php**********************<? include "http://www.MySite.com/Dirctory/cron.php" ;?>**********************or would i have to execute the script???**********************<?phpexec ('http://www.MySite.com/Dirctory/cron.php');?>********************** Quote Link to comment https://forums.phpfreaks.com/topic/20013-cron-jobs-running-from-remote-server/#findComment-89869 Share on other sites More sharing options...
ober Posted September 11, 2006 Share Posted September 11, 2006 I'm almost 100% sure you cannot "exec" a file on a remote server. You would have to include the file. Quote Link to comment https://forums.phpfreaks.com/topic/20013-cron-jobs-running-from-remote-server/#findComment-89874 Share on other sites More sharing options...
mainewoods Posted September 11, 2006 Share Posted September 11, 2006 maybe you can just use the file_get_contents function:Name: cron.php on friends server, runs every 15 minutes**********************[code]<? file_get_contents("http://yourgodaddysite.com/runit.php") ;?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/20013-cron-jobs-running-from-remote-server/#findComment-89879 Share on other sites More sharing options...
cohan1279 Posted September 11, 2006 Share Posted September 11, 2006 very simple, get visual cron http://www.visualcron.com/ i ran into the same problem as you and found this. its set up real nice and easy. i cant recall the cost but you can try it free. youll have to download the program and set up your jobs through it on your computer, just add the url to the cron script on your site and the times to run, then the sever from visual cron does it. Quote Link to comment https://forums.phpfreaks.com/topic/20013-cron-jobs-running-from-remote-server/#findComment-89887 Share on other sites More sharing options...
Wildhalf Posted September 11, 2006 Author Share Posted September 11, 2006 thanks all.... Ill give it a go later and tell you how it goes Quote Link to comment https://forums.phpfreaks.com/topic/20013-cron-jobs-running-from-remote-server/#findComment-89904 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.