deployer/docs/contrib/crontab.md
Anton Medvedev 6113e5e4f5 Improve docs
2022-09-12 12:53:42 +02:00

1.2 KiB

Crontab Recipe

require 'contrib/crontab.php';

Source

Recipe for adding crontab jobs.

It checks for duplicates by the command part of the job. Changing the schedule will update the crontab. So when you change the command part you have to manually remove the old one. Use crontab -e on the server to remove it.

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

Get path to bin

return which('crontab');

Tasks

crontab:load

Source

Loads crontab.

crontab:sync

Source

Sync crontab jobs.