Skip to content

Support crontab checking #3349

@mkesper

Description

@mkesper

For new checks and feature suggestions

My apologies if this was already discussed but my searches did not turn up anything relevant here.

Here's a snippet or screenshot that shows a potential problem:

#shellcheck shell=crontab
PATH=/sbin:/bin:/usr/sbin:/usr/bin
# Run all jobs with up to 15 min delay to avoid resource spikes
RANDOM_DELAY=900
*/10 * * * * bash -lc "sleep \$((RANDOM % RANDOM_DELAY)); echo Still alive!

Here's what shellcheck currently says:

[Line 5:](javascript:setPosition(5, 1))
*/10 * * * * bash -lc "sleep \$((RANDOM % RANDOM_DELAY)); echo Still alive!
^-- [SC1009](https://www.shellcheck.net/wiki/SC1009) (info): The mentioned syntax error was in this simple command.
                      ^-- [SC1073](https://www.shellcheck.net/wiki/SC1073) (error): Couldn't parse this double quoted string. Fix to allow more checks.
>>

Here's what I wanted to see:

An analysis of the shell code to be executed via cron.
For that to work, I suggest a remark with shell=crontab (or similar) and parsing according to POSIX cron definitions.

Thanks for your awesome tool and any input re this request!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions