Software Development Kit

cPanel & WHM's API [+] cPanel & WHM's API [-]


Modules and Plugins [+] Modules and Plugins [-]


cPanel & WHM Hooks [+] cPanel & WHM Hooks [-]


cPAddons (Site Software) [+] cPAddons (Site Software) [-]


System Administration [+] System Administration [-]


Developer Software [+] Developer Software [-]


Back to All Documentation



integrationblogcta.jpg

Cron Module Documentation

The Cron module allows you to schedule tasks in cron.

The functions within this module may or may not be governed by a feature list. The required feature list may vary from function to function, to review a total list of the available features sets on a cPanel server, please see "Feature Manager" in WHM.

Cron::set_email

API Version: 2 - Click here for documentation
Description: Set the default notification email for the cron system.
Parameters:  
  email (string)
  The email address that should receive notifications from the cron system.
Returns:  
 
<data>
  <status> A boolean value indicating success or failure. '1' for success. '0' for failure.</status>
  <statusmsg> A string value that contains either a success message or a reason for failure.</statusmsg>
  <email> The email address you have configured as the default notification address. (e.g. 'email@example.com')</email>
</data>

Cron::listcron

API Version: 2 - Click here for documentation
Description: Lists cronjobs by user. This function will include the sequence (num) and task of the cronjob.
Returns:  
 
<data>
  <day> This value can be either a string or an integer that indicates the day on which the cronjob will run. The value can range from 0-9 or include an asterisk, indicating the day on which the cronjob will run. An asterisk by itself means that the job will run daily.</day>
  <weekday> This value can be either string or integer that indicates the weekday on which the cronjob will run.</weekday>
  <minute> This value can be either a string or integer that indicates the minute the cronjob will run.</minute>
  <hour> This value can be either a string or integer that indicates the hour that the cronjob will run.</hour>
  <month> This value can be either a string or integer that indicates when the cronjob will run.</month>
  <count> This value is an integer that specifies the cronjob in sequence.</count>
  <command> This value is a string that contains the path to the command, script, or program that will run.</command>
  <command_htmlsafe> This value is a string that contains an HTML safe version of the path to the command, script, or program that will run.</command_htmlsafe>
</data>

Cron::add_line

API Version: 2 - Click here for documentation
Description: Add a crontab entry.
Parameters:  
  command (string)
  The command, script, or program you wish for your cronjob to execute.
  day (integer)
  The day on which you would like this crontab entry to run. Wildcards and any acceptable input to a crontab time expression line are allowed here.
  hour (integer)
  The hour at which you would like this crontab entry to run. Wildcards and any acceptable input to a crontab time expression line are allowed here.
  minute (integer)
  The minute at which you would like this crontab entry to run. Wildcards and any acceptable input to a crontab time expression line are allowed here.
  month (integer)
  The month you would like this crontab entry to run. Wildcards and any acceptable input to a crontab time expression line are allowed here.
  weekday (integer)
  The weekday on which you would like this crontab entry to run. Wildcards and any acceptable input to a crontab time expression line is allowed here. Acceptable values range from 0 to 6, where 0 represents Sunday and 6 represents Saturday.
Returns:  
 
<data>
  <status> A boolean value indicating success or failure. '1' for success. '0' for failure.</status>
  <statusmsg> A string value that contains a success message or a reason for failure.</statusmsg>
  <linekey> A random string used to identify the line on which the task was added.</linekey>
</data>

Cron::remove_line

API Version: 2 - Click here for documentation
Description: Remove an entry from the crontab.
Parameters:  
  line (integer (optional))
  The line number of the crontab entry you wish to remove, as reported by listcron.
Returns:  
 
<data>
  <status> A boolean value indicating success or failure. '1' for success. '0' for failure.</status>
  <statusmsg> A string value that contains a success message or a reason for failure.</statusmsg>
</data>

Cron::get_email

API Version: 2 - Click here for documentation
Description: This function returns the default notification email address for the authenticated user's crontab.
Returns:  
 
<data>
  <email> The user's default notification address for cron. (e.g. 'email@example.com')</email>
</data>

Cron::edit_line

API Version: 2 - Click here for documentation
Description: Edit a crontab entry.
Parameters:  
  command (string)
  The command, script, or program that you wish for your cronjob to execute.
  day (integer)
  The day on which you would like this crontab entry to run. Wildcards and any acceptable input to a crontab time expression line is allowed here.
  hour (integer)
  The hour at which you would like this crontab entry to run. Wildcards and any acceptable input to a crontab time expression line is allowed here.
  commandnumber (integer (optional))
  The line of the cron entry to be edited, as reported by listcron. If this is not specified, linekey (see below) must be specified.
  linekey (integer (optional))
  The linekey for the entry to be edited, as reported by listcron. If this is not specified, commandnumber (see above) must be specified.
  minute (integer)
  The minute at which you would like this crontab entry to run. Wildcards and any acceptable input to a crontab time expression line is allowed here.
  month (integer)
  The month you would like this crontab entry to run. Wildcards and any acceptable input to a crontab time expression line is allowed here.
  weekday (integer)
  The weekday on which you would like this crontab entry to run. Wildcards and any acceptable input to a crontab time expression line is allowed here. Acceptable values range from 0-6, where 0 represents Sunday and 6 represents Saturday.
Returns:  
 
<data>
  <status> A boolean value indicating success or failure. '1' for success. '0' for failure.</status>
  <statusmsg> A string that contains a success message or reason for failure.</statusmsg>
  <linekey> A random string used to identify the line on which the task was added.</linekey>
</data>

Topic revision: r2 - 22 Mar 2012 - 21:01:27 - Main.JenniferDoubrava