In a previous post Job scheduling with PHP - 2 I introduced the three main XML scripts my PHP job scheduler use for defining scheduled events. In this post we are going to take a more detailed look at the context and the schedule scripts.
In the next post Job Scheduling with PHP - 4 I will describe the job XML script and the job iterator , which is the most interesting feature of my job scheduling system.
There is not so much to tell about the context. it is the master script of the config library and as the name suggests it sets the context for the job scheduling.
The <prereq> tag contains boolean statements that must evaluate to TRUE for execution to commence. Most of the other tags in there are self explanatory, it is declarations of files and databases the scheduler use.
An example of a context script
The schedule XML script define a scheduled instance or a unit of work you submit for execution. The schedule defines a chain of jobs, run time parameters, prerequisites, alert lists, logging how to interpret the success of job executions etc. There are a lot that goes into a schedule. Here I will discuss the basics and little more. In the previous post I ended by running an empty schedule, which is my scheduler version of ‘Hello, World’. Here is a more verbose schedule.
The control_day schedule contains a lot of things I will explain the most important:
I start from top:
‘mustcomplete=’yes’ - all actions must be successful otherwise executions is aborted
notify=’admfail.xml’ - after execution those in the list will be notified depending on the result
<variant> - defines runtime parms e.g. sap=acta_prod defines a SAP subsystem
<prereq> - boolean conditions that must be true for execution to commence
<job> - job declarations
<exit> - opsys commands executed after the job have executed
wait=’no’ - spin off the command and proceed with next task
parallel=’yes’ - is a hint to scheduler execute in parallel (fork) if possible
<init> - opsys commands executed before the job have executed
This schedule is a production schedule and it is kicked off from Cron via a shell script:
Here you see how the control_day schedule is kicked off from a bash shell script.
As you see my job controller starts by invoking a PHP script scriptS.php , (this is not a good name, but it hangs on from my very first PHP script which I named scriptS where S stands for Start ). I end this post by showing the the scriptS.php, I left out the initial documentation.
(In Job Scheduling with PHP - 4 I will describe the job XML script and the job iterator.)