Skip to content

Implement a scheduler #5

@bsutton

Description

@bsutton

I wonder if it might be nice to have a scheduler. Cron syntax is cryptic. A modern syntax might be nice.
Particularly with a built support for testing that your scheduled jobs ran at the correct time and with the correct permissions.
Something like

dshell schedule simulate 10:15 jobx.dart

This would run the scheduled job as if it was 10:15.

Other commands might be:

dshell schedule list

dshell schedule list <script.dart>

dshell schedule <script.dart> at 10:15

dshell schedule delete <n> - where <n> is a number output by list.
dshell schedule delete <script.dart> at 10:15
dshell schedule add <script.dart> interval 1 hour
dshell schedule add <script.dart> interval 1 hour, 30 seconds named backup
dshell schedule delete backup

The scheduled jobs would be stored in a configuration file under the ~/.dshell

Yaml would possible be a good target as it is already used in pubspec.yaml so would be familiar:

So maybe syntax like:

jobs:
/path/to/exe/or/script
name: backup
first_run: yyyy-mm-dd hh:MM:ss
re_occurs:
count: 1
or
forever
or
until: yyyy-mm-dd hh:MM:ss

interval:
seconds: 10
or
hours: 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions