List/Display and View All Cron Jobs With PHP

Here is a PHP function to display a list of all cron jobs.

/**
 * Display all cron jobs
 */
function isa_list_cronjobs(){
    exec('crontab -l', $data);
    ?><pre><?php print_r($data); ?></pre><?php
    return;
}

Use the function like this:

isa_list_cronjobs();

That will print the crontab array in a nicely formatted list that is easy to view, like this:

Array
(
    [0] => SHELL="/usr/local/cpanel/bin/jailshell"
    [1] => 0 0 1,15 * * /bin/sh /path/to/script/twicemonthlycron.sh >/dev/null 2>&1
    [2] => 0 0 * * 0 php /path/to/script/weeklycron.php >/dev/null 2>&1
    [3] => 0 8 * * * curl --request GET https://domain.tld/path/to/rest/ >/dev/null 2>&1
)

See more:

Questions and Comments are Welcome

Your email address will not be published. All comments will be moderated.

Please wrap code in "code" bracket tags like this:

[code]

YOUR CODE HERE 

[/code]