phpJobScheduler

phpJobScheduler - README
Author: DWalker.co.uk  For help and support please try the forum


Like it? Please consider to

Every penny or cent helps :-)

phpJobScheduler is designed to automate tasks by scheduling PHP scripts to run at set intervals.
This version runs silently (no screen output) but saves the output, including any errors, to the database.
Full details can be found at: www.phpjobscheduler.co.uk

Requirements:

Index:

 

 

To upgrade an existing installation:  there are TWO main points to note!

  1. Your existing scheduled tasks, if any exist, will remain unchanged within your database. 
    Also, you can retain your existing config file:  /phpjobscheduler/pjsfiles/config.inc.php

    If you have previously made changes to:  /phpjobscheduler/pjsfiles/constants.inc.php
    then you will need to make those changes again as this file now contains many new constants.

  2. When you have followed the details below (To complete a new installation) you MUST login to check your scheduled tasks, by doing so it will automatically update your database and add the required new fields to the tables as required.


To complete a new installation:

  1. Unzip the files to your computer

  2. Edit the file: /phpjobscheduler/pjsfiles/config.inc.php
    using notepad or your favourite PHP editor.
  3. Upload the folders and files to your server.

  4. YOU MUST password protect the "pjsfiles" folder - if you fail to do so and someone found the folder on your website they could add/delete/modify your scheduled jobs!  If you host on Unix or Linux add htaccess to the folder to force a username and password prompt before entry (if you host on a Windows machine RTFM).  You can normally add security to a folder using your Control Panel provided by your host (please contact your host for details - and NOT ME!).

  5. Then add the PHP or HTML code to your website (or websites - you can add it to more than one), this is to fire your scheduled tasks when due.  There are two methods:

    1. add to the START of an existing PHP file, for example to your index.php home page (and/or any other relevant page in the root directory):

      <?php include( dirname(__FILE__) . "/phpjobscheduler/firepjs.php"); ?>

    2. or simply add to an existing HTML page, like your index.html home page and/or any other well visited page on any website:
    Ensure you change 'YOURDOMAIN' to your own domain name!
    The above HTML can be added to any web page on any website (not just to the site where phpJobScheduler is installed). Adding this code will add a very small clear image to your page - invisible (unless you know its there). Execution is very quick so will not slow the loading of any pages.

     

  6. click here to add your scheduled tasks

  7. If you have correctly completed the above the following tables will be created in your database database:

      phpJobScheduler
      phpJobScheduler_log

  8. Click here to run the scheduled tasks already added above.  This allows you to check the output and to see all is working.  As DEBUG is on by default you should see some output if it is working for you like:  "Found script to run...", etc.



  9. When you are happy all is running without error set DEBUG to false, edit the file: /phpjobscheduler/pjsfiles/config.inc.php


Error log - recording of runs and errors of each fired task.

Recorded data: date of last run, and url including errors if any occur. If "Output:" has no data then this means the script ran without errors or output.

By default error logging is turned on (TRUE). To turn on/off error logs:

Change the value assigned to ERROR_LOG within the /pjsfiles/constants.inc.php file. Change the value to FALSE to stop logging. It will not affect the running of fired scripts if you turn off error logging.

The output is truncated to a maximum length of 1200 characters by default to ensure the logs table does not become too large. You can change this by editing the constant MAX_ERROR_LOG_LENGTH within the constants.inc.php file.

 

 

 


Altering the time frame window

This can be changed by altering the value assigned to TIME_WINDOW within the /pjsfiles/constants.inc.php file.  The default value is 3600 seconds (60 minutes  which should suffice for most sites).  This means that when the firing engine (phpjobscheduler/firepjs.php) is called any scheduled job having a fire time within 60 minutes will be executed.

You can increase or decrease the default value of the time frame window.  If your site receives just a few hits per day you should consider increasing the value to 43200 (12 hours).

If your site ALWAYS receives several hits per hour or more then you should consider reducing the value to suit your needs.

NEED more help?  Try the forum

 

 


DEBUG - for testing

DEBUG

When you are happy all is running without error set DEBUG to false, edit the file:

/phpjobscheduler/pjsfiles/config.inc.php

 

This will then prevent any output - so when you call firejps.php it will run silently.



HISTORY

Launch Date: 14th Oct 2003

Version and description of changes


DISCLAIMER

phpJobScheduler IS PROVIDED "AS IS" WITHOUT REPRESENTATION OR WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY REPRESENTATIONS OR ENDORSEMENTS REGARDING THE USE OF, THE RESULTS OF, OR PERFORMANCE OF THE INFORMATION, ITS APPROPRIATENESS, ACCURACY, RELIABILITY, OR CORRECTNESS.
THE ENTIRE RISK AS TO THE USE OF phpJobScheduler IS ASSUMED BY THE USER.  IN NO EVENT I BE LIABLE FOR ANY DAMAGES, DIRECT, INDIRECT, INCIDENTAL OR CONSEQUENTIAL, RESULTING FROM ANY DEFECT IN phpJobScheduler, EVEN IF THE POSSIBILITY OF SUCH DAMAGES HAS BEEN ADVISED.   THIS DISCLAIMER SHALL SUPERSEDE ANY VERBAL OR WRITTEN STATEMENT TO THE CONTRARY. IF YOU DO NOT ACCEPT THESE TERMS YOU MUST CEASE AND DESIST USING phpJobScheduler IMMEDIATELY.

 

My applications:

phpAMA - create a members area using PHP MySQL, protect your members only or adult content
phpAutoMembersArea
phpMySQLAutoBackup - automate the backup of your MySQL databases and email a copy to yourself
phpMySQLAutoBackup
phpJobScheduler - scheduling PHP scripts to run at set intervals your replacement for cron jobs. 
phpJobScheduler