Skip to main content
Version: 8.x

Crontab Recipe

require 'contrib/crontab.php';

Source

Recipe for adding crontab jobs. This recipe creates a new section in the crontab file with the configured jobs. The section is identified by the crontab:identifier variable, by default the application name.

Configuration

  • crontab:jobs - An array of strings with crontab lines.

Usage

require 'contrib/crontab.php';
after('deploy:success', 'crontab:sync');
add('crontab:jobs', [
'* * * * * cd {{current_path}} && {{bin/php}} artisan schedule:run >> /dev/null 2>&1',
]);

Configuration

bin/crontab

Source

Recipe for adding crontab jobs. This recipe creates a new section in the crontab file with the configured jobs. The section is identified by the crontab:identifier variable, by default the application name.

Configuration

  • crontab:jobs - An array of strings with crontab lines.

Usage

require 'contrib/crontab.php';
after('deploy:success', 'crontab:sync');
add('crontab:jobs', [
'* * * * * cd {{current_path}} && {{bin/php}} artisan schedule:run >> /dev/null 2>&1',
]);

Get path to bin

Default value
return which('crontab');

crontab:identifier

Source

Set the identifier used in the crontab, application name by default

Default value
return get('application', 'application');

crontab:use_sudo

Source

Use sudo to run crontab. When running crontab with sudo, you can use the -u parameter to change a crontab for a different user.

Default value
false

Tasks

crontab:sync

Source

Sync crontab jobs.