Jump to content

Cron Jobs - running from remote server


Wildhalf

Recommended Posts

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???

or

Is 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
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

example_fake_cron.php: [code]#!/usr/bin/php
<?php
while(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.
Link to comment
Share on other sites

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.php

or do i need the /php (don't think its this one)

/php/http://www.MyDomain.com/Dir/cron.php

Could some one please advise??
Link to comment
Share on other sites

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.....
Link to comment
Share on other sites

If your code is developed properly you'll not have any problems porting to a new server :p

Seriously 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.
Link to comment
Share on other sites

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.php

or do i need the /php (don't think its this one)

/php/http://www.MyDomain.com/Dir/cron.php

Could some one please advise??

[/quote]
Link to comment
Share on other sites

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 that

Could 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???

**********************
<?php
exec ('http://www.MySite.com/Dirctory/cron.php');
?>
**********************
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.