Projected Cron Jobs

Someone was asking my advice today on how they could get around a problem.

They said that they had an automated system where all they had to do to deploy a site was FTP up a few files and folders to each host they used.

However the system they designed required them to also create a cron job on each host. This was A: Slowing them down and B: Some hosts dont allow it

Well here is a simple and easy solution to it for anyone who needs one: -

Create a page on your main site (hidden or behind some sort of protection) where it contains a number of IFRAMES
Each of these IFRAMES contains the page you would have called from the cron on the remote site
Then create a cron job on your central site to load the page with the IFRAMES in it.

Simple really

2010-05-12_2319

No related posts.

2 Comments

  1. Posted May 12, 2010 at 11:42 pm | Permalink

    I like your thinking; would it not be easier to just create one PHP script though and go through all your external cron jobs like:

    <?php
    exec("wget -O – -q -t 1 http://www.example.com/hidden_dir/cron.php");

    exec(“wget -O – -q -t 1 http://www.example2.com/hidden_dir/cron.php“);

    exec(“wget -O – -q -t 1 http://www.example3.com/hidden_dir/cron.php“);

    exec(“wget -O – -q -t 1 http://www.example4.com/hidden_dir/cron.php“);
    ?>

    Then you can just run this one php script as your cron job and it will call all the other scripts for you.

    Another good thing about wget is that it supports htaccess username/password authentication, so you could protect all your external cron scripts as well
    and still call them like:

    exec(“wget –user=user –password=pass -O – -q -t 1 http://www.example5.com/hidden_dir/cron.php“);

  2. SEOidiot
    Posted May 13, 2010 at 3:12 am | Permalink

    Yup Jon probably, but this took 20 secs to set up and works ok :)

Leave a comment. Your email is never published nor shared. Required fields are marked *

*
*

my best posts

rss feed