Adding Custom CP Cron Jobs

CP cron jobs are internal Parallels 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.
  3. Extend the abstract class psoft.hsphere.background.BackgroundJob and implement the method:

    protected abstract void processJob() throws Exception

  4. Add the custom cron job class to CLASSPATH set in the .bash_profile file located in the ~panel home directory.
  5. 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, ~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.
    1. Set the full pathname to the custom cron configuration file in ~cpanel/shiva/psoft_config/hsphere.properties:

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

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

    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 XML Configuration guide.

In this section:

CP Cron XML Configuration