Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Applies to:

Zend Server 8.5.X

GNU / Linux

Microsoft Windows

OS X

Issue:

The day 31 is not listed when scheduling a monthly recurring Job from Zend Server UI | Job Queue | Recurring Jobs.

Solution 1:

To fix the issue, you need to do a small change in the file /usr/local/zend/gui/module/JobQueue/views/job-queue/recurring-jobs/form.phtml for GNU / Linux and OS X or in C:\Program Files (x86)\Zend\ZendServer\gui\module\JobQueue\views\job-queue\recurring-jobs\form.phtml for Microsoft Windows to add the day 31.

For GNU / Linux:

Execute the following commands as root:


Panel
bgColor#eeeeee
# cd /usr/local/zend/gui/module/JobQueue/views/job-queue/recurring-jobs/
# cp form.phtml form.phtml-orig
# sed -i 's/day < 31/day <= 31/' form.phtml

For Microsoft Windows:

     1.  Create a backup copy of form.phtml

     2.  Open form.phtml in a text editor

     3.  Locate the following line (should be line 422):


Panel
bgColor#eeeeee
<?php for ($day = 1; $day < 31; $day++): ?>

     4.  Replace it with:


Panel
bgColor#eeeeee
<?php for ($day = 1; $day <= 31; $day++): ?>

     5.  Save the file.

For OS X:

Panel
bgColor#eeeeee
$ sudo $ sudo sed -i '.original' 's/day < 31/day <= 31/' /usr/local/zend/gui/module/JobQueue/views/job-queue/recurring-jobs/form.phtml

This will backup the file form.phtml as form.phtml.original and do the necessary change.

Finally refresh the Zend Server UI page and go to the recurring Job rule's page to see whether the day 31 appears in the drop down list while adding a Monthly Job rule.

Solution 2:

The Zend Server UI has some limitations in scheduling the recurring jobs - it is in fact impractical to implement the full UI to cron. Therefore, if you need to implement some advanced scheduling options, consider doing this through Zend Server's Job Queue API - by means of a simple PHP script. For example, if you want to run a job at the last day of each month, you can do it like this:


Panel
bgColor#eeeeee
<?php
 
$URL="http://server/monthly_report.php";
$queue = new ZendJobQueue(); 
 
$jobId31 = $queue->createHttpJob($URL, array(), array("name" => "Monthly Report: 31-day months", "schedule" => "0 1 31 1,3,5,7,8,10,12")); 
$jobId30 = $queue->createHttpJob($URL, array(), array("name" => "Monthly Report: 30-day months", "schedule" => "0 1 30 4,6,9,11")); 
$jobId28 = $queue->createHttpJob($URL, array(), array("name" => "Monthly Report: February", "schedule" => "0 1 28 2"));

These jobs will run at 1:00AM on the last day of each month.

Note:

This issue is already resolved in the next Zend Server release 9.0.