whenever icon indicating copy to clipboard operation
whenever copied to clipboard

whenever command should default to --update-crontab

Open MartinNowak opened this issue 9 years ago • 1 comments

Right now it's really easy to overwrite everything else in your crontab by just running then whenever command. Since the crontab entry already has delimiters (also used by the --update-crontab option) to just update the section that belongs to whenever, one would expect this to be the default behavior. Please change the default behavior of the command and add an optional --overwrite-crontab instead.

MartinNowak avatar Jul 07 '16 18:07 MartinNowak

I just did this and quite unexpectedly overwrote my crontab... :| The --help content was not helpful in guiding me away from this.

Usage: whenever [options]
    -i [identifier],                 Default: full path to schedule.rb file
        --update-crontab
    -w, --write-crontab [identifier] Default: full path to schedule.rb file
    -c, --clear-crontab [identifier]
    -s, --set [variables]            Example: --set 'environment=staging&path=/my/sweet/path'
    -f, --load-file [schedule file]  Default: config/schedule.rb
    -u, --user [user]                Default: current user
    -k, --cut [lines]                Cut lines from the top of the cronfile
    -r, --roles [role1,role2]        Comma-separated list of server roles to generate cron jobs for
    -x, --crontab-command [command]  Default: crontab
    -v, --version

The part about --update-crontab isn't obvious, as it is tied to an identifier option. I get the impression that -i actually means install instead of --identifier? This was not obvious. I looked at https://github.com/javan/whenever/blob/master/bin/whenever to see if it made more sense, and I see that identifier is an optional arg.

I think:

  • The default should be to update the crontab, not overwrite an existing (yikes!)
  • the -i command should be more obvious of the intent.

Edit: Perhaps this is a slightly different issue: I didn't run whenever on it's own -- that displays the parsed cron, which is helpful. But it wasn't obvious that I should run whenever -i (--install ?) instead of whenever -w.

ttilberg avatar Dec 12 '19 16:12 ttilberg