Skip to content

Crontab: allow sudo with crontab:use_sudo option#3759

Merged
antonmedv merged 3 commits into
masterfrom
unknown repository
Dec 22, 2023
Merged

Crontab: allow sudo with crontab:use_sudo option#3759
antonmedv merged 3 commits into
masterfrom
unknown repository

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Dec 21, 2023

This makes it possible to overwrite the bin/crontab variable to edit crontab for other users.

e.g.

set("crontab:use_sudo", true);
set("bin/crontab", function () {
  return which('crontab') . " -u www-data";
});
  • Bug fix #…?

  • New feature?

  • BC breaks?

  • Tests added?

  • Docs added?

    Please, regenerate docs by running next command:
    $ php bin/docgen
    

Jesko Karwasz added 3 commits December 21, 2023 15:09
This makes it possible to overwrite the bin/crontab variable to edit crontab for other users.

e.g.

set("crontab:use_sudo", true);
set("bin/crontab", function () {
  return which('crontab') . " -u www-data";
});
@antonmedv antonmedv merged commit e518a42 into deployphp:master Dec 22, 2023
midweste pushed a commit to midweste/deployer that referenced this pull request Jan 16, 2024
* upstream/master: (78 commits)
  [automatic] Update docs with bin/docgen
  Move Caddy file in to separate file (deployphp#3765)
  Create parent folders if needed (deployphp#3764)
  [automatic] Update docs with bin/docgen
  Switch to owner change instead of shh user change (deployphp#3763)
  Don't show warning if `become` parameter is set to `root` (deployphp#3761)
  [automatic] Update docs with bin/docgen
  Adding Spiral Framework recipe (deployphp#3582)
  Crontab: allow sudo with crontab:use_sudo option (deployphp#3759)
  fix: run cachetool without args (deployphp#3742)
  Fix version variables in Contao recipe (deployphp#3735)
  contrib: fix creating cron jobs first time
  Removing wrong information regarding reverse DNS (deployphp#3726)
  [automatic] Update docs with bin/docgen
  Fix issue provoked after adding array casting and returning empty fcgi parameter to the command (deployphp#3724)
  Revert "[TASK] Update TYPO3 recipe (deployphp#3674)" (deployphp#3723)
  ci-cd docs: update link to gitlab doc section (deployphp#3721)
  [automatic] Update docs with bin/docgen
  Fix test function (deployphp#3717)
  [automatic] Update docs with bin/docgen
  ...
@SimJoSt
Copy link
Copy Markdown
Contributor

SimJoSt commented Mar 10, 2026

Ah, finally I found the intended use!
From https://deployer.org/docs/8.x/contrib/crontab#crontab-1 it wasn't clear to me how and where to use the -u flag.
I didn't think overwriting the bin/crontab variable (https://deployer.org/docs/8.x/contrib/crontab#bincrontab) is the way to go. I thought there would be a simple configuration path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants