GithubHelp home page GithubHelp logo

ezcron's Introduction

Ezcron

Go Report Card Software License

Ezcron is a CLI tool, helping you deal with cron expression easier.

Feature

  • Creating cron expression with prompts
  • Translate cron expression into human-friendly language
  • Show the next execute time
  • And more (keep working) ...

DEMO

Create cron expression like a boss ๐Ÿ˜Ž

demo

See more DEMO at example

CRON Expression Format

Only support 5 fields.

# โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ minute (0 - 59)
# โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ hour (0 - 23)
# โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ day of month (1 - 31)
# โ”‚ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ month (1 - 12)
# โ”‚ โ”‚ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ day of  week (0 - 6) (Sunday to Saturday)
# โ”‚ โ”‚ โ”‚ โ”‚ โ”‚
# โ”‚ โ”‚ โ”‚ โ”‚ โ”‚
# โ”‚ โ”‚ โ”‚ โ”‚ โ”‚
# * * * * *
------------------------------------------------------------------------
Field name     Mandatory?   Allowed values    Allowed special characters
----------     ----------   --------------    --------------------------
Minutes        Yes          0-59              * / , -
Hours          Yes          0-23              * / , -
Day of month   Yes          1-31              * / , -
Month          Yes          1-12 or JAN-DEC   * / , -
Day of week    Yes          0-6 or SUN-SAT    * / , -

Installing

go get -u github.com/rueyaa332266/ezcron

Usage

Usage:
  ezcron [flags]
  ezcron [command]

Available Commands:
  expression  Create a cron expression
  help        Help about any command
  next        Return next execute time
  translate   Translate into human-friendly language

Flags:
  -h, --help   help for ezcron

Use "ezcron [command] --help" for more information about a command.

Example

Create cron expression

$ ezcron expression

Five types of schedule are available.

  • Time schedule:

    Create a schedule in time intervals.

    • every_miniute {X_MINUTE}
    • every_hour {X_HOUR}

    demo

  • Daily schedule:

    Create a daily schedule at specific time.

    • every_day
    • every_day at {HH:MM}

    demo

  • Weekly schedule:

    Create a weekly schedule on specific weekday at specific time.

    • on_every {WEEKDAY}
    • on_every {WEEKDAY} at {HH:MM}

    demo

  • Monthly schedule

    Create a monthly schedule on specific monthday at specific time.

    • on {MONTHDAY} of_every_month
    • on {MONTHDAY} of_every_month at {HH:MM}
    • on {MONTHDAY} of_every {X_MONTH}
    • on {MONTHDAY} of_every {X_MONTH} at {HH:MM}

    demo

  • Yearly schedule

    Create a yearly schedule on specific date at specific time.

    • in_every {MONTH} {MONTHDAY}
    • in_every {MONTH} {MONTHDAY} at {HH:MM}

    demo

Translate cron expression

$ ezcron translate "* * * * *"
At every minute

It also works when passing the cron expression by pipe.

$ echo "* * * * *" | ezcron
At every minute

Show next execute time

$ ezcron next "* * * * *"
Next execute time: 2020-05-10 22:35:00 +0900 JST

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.