Back to Deployer

Crontab Recipe

docs/contrib/crontab.md

8.0.32.2 KB
Original Source
<!-- DO NOT EDIT THIS FILE! --> <!-- Instead edit contrib/crontab.php --> <!-- Then run bin/docgen -->

Crontab Recipe

php
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

php
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

php
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

php
return which('crontab');

crontab:identifier

Source

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

php
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.

php
false

Tasks

crontab:sync {#crontab-sync}

Source

Sync crontab jobs.

crontab:remove {#crontab-remove}

Source

Remove crontab jobs.