Monthly Job Scheduling Form Doesn't Have the Day 31

Follow

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:

# 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):

<?php for ($day = 1; $day < 31; $day++): ?>

     4.  Replace it with:

<?php for ($day = 1; $day <= 31; $day++): ?>

     5.  Save the file.

 

For OS X:

$ 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:

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

 

Have more questions? Submit a request

Comments

Powered by Zendesk