phpJobScheduler

READ ME

Author: http://www.DWalker.co.uk  For help and support please try the forum: http://www.dwalker.co.uk/forum/

Please consider making a donation, even a single Dollar (or a Pound) would be great!

My other applications:

Create your own members area:
phpAMA - create a members area using PHP MySQL, protect your members only or adult content
phpAutoMembersArea

Automate your database backups with ease and without the hassle:
phpMySQLAutoBackup automates the backup of MySQL databases.
phpMySQLAutoBackup

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:
http://www.phpjobscheduler.co.uk/

Requirements:

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 and change:

    define('DBHOST', 'localhost');// MySQL host address - localhost is usually fine
    define('DBNAME', '-');// MySQL database name - must already exist
    define('DBUSER', '-');// MySQL username - must already exist
    define('DBPASS', '-');// MySQL password for above username

  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 the Control Panel provided by your host (please contact your host for details - and NOT ME!).
  5. Then add the PHP code to fire your scheduled tasks when due.  There are two methods:
    1. add to the END 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. add to the END of an existing HTML file, for example to your index.html home page (and/or any other relevant page):

    <img src="http://www.YOUR-domain/phpjobscheduler/firepjs.php?return_image=1" width="1" height="1">

    Adding the above img tag will add a very small clear image to your page - almost invisible.

  6. Finally  click here to add your scheduled tasks

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

        phpJobScheduler
        phpJobScheduler_log


To upgrade an existing installation:

  1. Follow the details above - your existing scheduled tasks, if any exist, will remain unchanged within your database. 
      Retain your existing /phpjobscheduler/pjsfiles/config.inc.php file, and password files (.htaccess and .htpasswd). You may also wish to edit the constants.inc.php file to suit your requirements.

  2. Login to check your scheduled tasks are still waiting to be fired, by doing so it will automatically update your database and add the required new fields to the tables.

  3.  


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

MINUTES!
If you wish to schedule tasks to fire each minute then you MUST alter the TIME_WINDOW accordingly; and the script must be added to pages (see 5 above) that receive at least one hit per minute (or x minutes as per the minimum number of minutes your most frequent jobs are required to run). Note the you can add the firing code (see 5 above) to multiple pages or sites.

NEED more help?  Try http://www.dwalker.co.uk/forum/

 

 

 


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.