Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 2 Current »

This class should not be used in FreePBX 14.0.12 or 15.0.12 or higher. You should use the centralized Job class instead.

Cron Class. Adds and removes entries to Crontab, usually as the Asterisk user

FreePBX::Cron()->getAll();

Function Calls

getAll()

Returns an array of all the lines for the user

/**
 * Returns an array of all the lines for the user
 * @return array Crontab lines for user
 */
public function getAll() {}

checkLine()

Checks if the line exists exactly as is in this users crontab

/**
 * Checks if the line exists exactly as is in this users crontab
 * @param {string} $line Line to check
 * @return {bool} True or false if the line exists
 */
public function checkLine($line = null) {}

addLine()

Add the line given to this users crontab

/**
 * Add the line given to this users crontab
 * @param {string} $line The line to add
 * @return {bool} Return true if the line was added
 */
public function addLine($line) {}

remove()

Remove the line given (if it exists) from this users cronttab.

Note: this will only remove the first if there's a duplicate.

/**
 * Remove the line given (if it exists) from this users cronttab.
 * Note: this will only remove the first if there's a duplicate.
 * @param  {string} $line The line to remove
 * @return {bool} True if removed, false if not found
 */
public function remove($line) {}

removeLine()

Alias of the function below, removing a line

/**
 * Remove the line given (if it exists) from this users cronttab.
 * Note: this will only remove the first if there's a duplicate.
 * @param  {string} $line The line to remove
 * @return {bool} True if removed, false if not found
 */public function removeLine($line) {}

add()

Add an entry to Cron. Takes either a direct string, or an array

/**
 * Add an entry to Cron. Takes either a direct string, or an array of the following options:
 * Either (a string):
 *   * * * * * /bin/command/to/run
 * or
 *  array (
 *    array("command" => "/bin/command/to/run",  "minute" => "1"), // Runs command at 1 minute past the hour, every hour
 *    array("command" => "/bin/command/to/run", "magic" => "@hourly"), // Runs it hourly
 *    "* * * * * /bin/command/to/run",
 *    array("@monthly /bin/command/to/run"), // Runs it monhtly
 *  )
 *
 * See the end of 'man 5 crontab' for the extension commands you can use.
 * crontab does sanity checking when importing a crontab. If this is throwing an exception
 * about being unable to add an entry,check the error file /tmp/cron.error for reasons.
 */
public function add() {}

removeAll()

Removes all reference of $cmd in cron

/**
 * Removes all reference of $cmd in cron
 * @param {string} $cmd The command to remove
 */
public function removeAll($cmd) {}
  • No labels