Parallels H-Sphere Documentation Developer Guide

 

Adding Custom CP Cron Jobs

 
 

Related Docs:   CP Cron Configuration

Last modified: 28 Dec 2007

 

WARNING: This documentation covers Parallels H-Sphere versions up to 3.1. For the latest up-to-date Parallels H-Sphere documentation, please proceed to the official Parallels site.

CP cron jobs are internal H-Sphere Java utilities that perform regular tasks such as accounting, trouble ticket management, etc.

It is possible to manage crons in XML configuration files and to add custom cron jobs.

To create a custom cron job:

  1. Log in as the cpanel user.

  2. Create the cron job class

    Extend the abstract class psoft.hsphere.background.BackgroundJob and implement the method
    protected abstract void processJob() throws Exception

  3. Add the custom cron job class to CLASSPATH

    CLASSPATH is set in the .bash_profile file located in the cpanel home directory.

  4. Create the custom cron XML configuration file if it is not created yet

    We recommend to add all custom cron jobs into the custom cron configuration file, not to the standard cron XML configuration file.

    1) Create the custom cron configuration file, for example, /hsphere/local/home/cpanel/shiva/custom/xml/cron_config.xml

    2) The XML structure of the custom cron config file should be the same as of the standard cron configuration file.

    DTD scheme | Example

    3) Set the full pathname to the custom cron configuration file in hsphere.properties (/hsphere/local/home/cpanel/shiva/psoft_config/hsphere.properties):

    CRON_CONFIG = /hsphere/local/home/cpanel/shiva/custom/xml/cron_config.xml

  5. Add the custom cron job to the custom cron configuration file

    1) If the custom cron configuration is not created, create it according to the procedure specified in the previous step.

    2) Add a new group of jobs if required or add your custom cron job there, or, add your custom job to an existing group. Group is set by the group tag. Jobs are set in the cron tags within their groups. For example:

    <config>
    ...
      <group name="GroupN" maxpriority="10" defpriority="3">
      <!-- priority of jobs within the group is ranked from 1 to 10;
           if job priority is not specified, it is 3 by default -->

      ...
        <job name="CustomCron" class="custom.cron.CustomCron"
          starttime="5:00" period="1440"/>
        <!-- job starts every day (1440 minutes) at 5am -->
      ...
      <group>
    </config>

    XML syntax is described in the CP Cron Configuration guide.

    Read how to merge XML config files in Customization Guide.


Related Docs:   CP Cron Configuration



© Copyright 2017. Parallels Holdings. All rights reserved.