diff --git a/contrib/crontab.php b/contrib/crontab.php index 835e1146e..2717135df 100644 --- a/contrib/crontab.php +++ b/contrib/crontab.php @@ -34,7 +34,7 @@ return get('application', 'application'); }); -// Use sudo to run crontab +// Use sudo to run crontab. When running crontab with sudo, you can use the `-u` parameter to change a crontab for a different user. set('crontab:use_sudo', false); desc('Sync crontab jobs'); diff --git a/docs/contrib/crontab.md b/docs/contrib/crontab.md index 0c7f7d784..45017d838 100644 --- a/docs/contrib/crontab.md +++ b/docs/contrib/crontab.md @@ -21,30 +21,24 @@ Get path to bin return which('crontab'); ``` -### crontab:use_sudo -Runs crontab as sudo. +### crontab:identifier +[Source](https://github.com/deployphp/deployer/blob/master/contrib/crontab.php#L33) + +Set the identifier used in the crontab, application name by default ```php title="Default value" -false +return get('application', 'application'); ``` -When running crontab with sudo, you can use the `-u` parameter to change a crontab for a different user. - -```php title="Example usage" -set('crontab:use_sudo', true); -set('bin/crontab', function () { - return which('crontab') . ' -u www-data'; -}); -``` -### crontab:identifier -[Source](https://github.com/deployphp/deployer/blob/master/contrib/crontab.php#L33) +### crontab:use_sudo +[Source](https://github.com/deployphp/deployer/blob/master/contrib/crontab.php#L38) -Set the identifier used in the crontab, application name by default +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 title="Default value" -return get('application', 'application'); +false ``` @@ -52,7 +46,7 @@ return get('application', 'application'); ## Tasks ### crontab:sync -[Source](https://github.com/deployphp/deployer/blob/master/contrib/crontab.php#L38) +[Source](https://github.com/deployphp/deployer/blob/master/contrib/crontab.php#L41) Sync crontab jobs.