From 353fcf52e217a4da372f5b73538362471e8a0891 Mon Sep 17 00:00:00 2001 From: Jorin Vogel Date: Mon, 2 Jan 2017 19:20:46 +0100 Subject: [PATCH] setup --- .gitignore | 2 ++ .travis.yml | 12 ++++++++ README.md | 38 ----------------------- LICENSE => license | 0 readme.md | 75 ++++++++++++++++++++++++++++++++++++++++++++++ release.sh | 27 +++++++++++++++++ 6 files changed, 116 insertions(+), 38 deletions(-) create mode 100644 .gitignore create mode 100644 .travis.yml delete mode 100644 README.md rename LICENSE => license (100%) create mode 100644 readme.md create mode 100755 release.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..20842b4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +releases +.DS_Store \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..c1f3609 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,12 @@ +language: go +go: + - 1.6.4 + - 1.7.4 + - tip +os: + - linux + - osx +matrix: + allow_failures: + - go: tip + fast_finish: true diff --git a/README.md b/README.md deleted file mode 100644 index e30fce8..0000000 --- a/README.md +++ /dev/null @@ -1,38 +0,0 @@ -# runat - -Like [runwhen](http://code.dogmap.org/runwhen/) but simpler: - -## Syntax -``` -runat -a b ... -``` - -with: - -``` -month in 1,...,12 -day in 1,...,31 -weekday in mo,tu,we,th,fr,sa,su -hour in 0,...,24 -minute in 0,...,60 -second in 0,...,60 -``` - -(24/60 alias to 0) - - -## Examples - -``` sh -# Every day at 1am -runat -hour 1 && ~/bin/dbbackup.sh -# Every 1st of month at 1am -runat -day 1 -hour 1 && ~/bin/letsencrypt-renew.sh -# Every 15 minutes -runat -minute 0,15,30,45 ~/bin/dbbackup.sh -``` - - -- Trigger right away on `SIGALRM` -- Waits forever (or til `SIGALRM`) when run without any conditions -- Logs next execution time (to stderr) before sleeping when `-verbose` is active diff --git a/LICENSE b/license similarity index 100% rename from LICENSE rename to license diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..e46a114 --- /dev/null +++ b/readme.md @@ -0,0 +1,75 @@ +# :floppy_disk: runat + +[![GoDoc](https://godoc.org/qvl.io/runat?status.svg)](https://godoc.org/qvl.io/runat) +[![Build Status](https://travis-ci.org/qvl/runat.svg?branch=master)](https://travis-ci.org/qvl/runat) +[![Go Report Card](https://goreportcard.com/badge/github.com/qvl/runat)](https://goreportcard.com/report/github.com/qvl/runat) + + +Like [runwhen](http://code.dogmap.org/runwhen/) but simpler: + +## Syntax +``` +runat -a b ... +``` + +with: + +``` +month in 1,...,12 +day in 1,...,31 +weekday in mo,tu,we,th,fr,sa,su +hour in 0,...,24 +minute in 0,...,60 +second in 0,...,60 +``` + +(24/60 alias to 0) + + +## Examples + +``` sh +# Every day at 1am +runat -hour 1 && ~/bin/dbbackup.sh +# Every 1st of month at 1am +runat -day 1 -hour 1 && ~/bin/letsencrypt-renew.sh +# Every 15 minutes +runat -minute 0,15,30,45 ~/bin/dbbackup.sh +``` + + +- Trigger right away on `SIGALRM` +- Waits forever (or til `SIGALRM`) when run without any conditions +- Logs next execution time (to stderr) before sleeping when `-verbose` is active + + +## Install + +- Via [Go](https://golang.org/) setup: `go get qvl.io/runat` + +- Or download latest binary: https://github.com/qvl/runat/releases + + +## Setup + +*TODO* + + +## Use as Go package + +From another Go program you can directly use the `runat` sub-package. +Have a look at the [GoDoc](https://godoc.org/qvl.io/runat/runat). + + +## Development + +Make sure to use `gofmt` and create a [Pull Request](https://github.com/qvl/runat/pulls). + +### Releasing + +Run `./release.sh ` and upload the binaries on Github. + + +## License + +[MIT](./license) diff --git a/release.sh b/release.sh new file mode 100755 index 0000000..ec85d50 --- /dev/null +++ b/release.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env sh +set -e + +NAME="runat" +# from args +VERSION="${1}" +test ${VERSION} || (echo "Usage: ./release.sh " && exit 1) + +mkdir -p releases +cd releases + +build () { + BUILD="${1}" + OS="${2}" + ARCH="${3}" + ZIP="${NAME}-${VERSION}-${BUILD}.zip" + echo "Building ${BUILD}" + GOOS=${OS} GOARCH=${ARCH} go build -v -o="${NAME}" -ldflags="-s -w" .. + echo "Creating zip file ${ZIP}" + zip ${ZIP} ${NAME} ../readme.md ../license + rm ${NAME} +} + + +build Windows-64bit windows amd64 +build MacOS-64bit darwin amd64 +build Linux-64bit linux amd64 \ No newline at end of file