Skip to content

Latest commit

 

History

History
53 lines (47 loc) · 1.11 KB

README.md

File metadata and controls

53 lines (47 loc) · 1.11 KB

CRON Expression Parser

Description

This application takes a single cron expression string as a command-line argument and prints out the expanded view of the given schedule.

Requirements

  • go 1.14+
  • make

Setup

  1. Clone git repository to local machine
git clone https://github.com/sqrt-7/go-cronexp.git && cd go-cronexp
  1. Download dependencies
go mod download
  1. Compile application
make build
  1. Run with cron expression as the argument
./run_cronexp "*/15 0 1,15 * 1-5 /usr/bin/find"
  1. Expected output (example)
minute        0 15 30 45
hour          0
day of month  1 15
month         1 2 3 4 5 6 7 8 9 10 11 12
day of week   1 2 3 4 5
command       /usr/bin/find

Testing

  • Unit tests are located at pkg/cronexp/cronexp_test.go
  • Run unit tests:
make unit-test

Troubleshooting

  • If the application has to be compiled for a specific os/architecture:
# For valid GOOS/GOARCH combinations run 
go tool dist list

# Replace GOOS and GOARCH with the chosen values
GOOS=darwin GOARCH=amd64 go build -o ./run_cronexp ./cmd/cli/main.go