Create the cron job class
Extend the abstract class psoft.hsphere.background.BackgroundJob
and implement the method
protected abstract void processJob() throws Exception
Add the custom cron job class to CLASSPATH
CLASSPATH is set in the .bash_profile file located in the cpanel home directory.
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
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.