Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
setup
Browse files Browse the repository at this point in the history
  • Loading branch information
jorinvo committed Jan 2, 2017
1 parent b17d8ea commit 353fcf5
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 38 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
releases
.DS_Store
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
38 changes: 0 additions & 38 deletions README.md

This file was deleted.

File renamed without changes.
75 changes: 75 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -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 <version>` and upload the binaries on Github.


## License

[MIT](./license)
27 changes: 27 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env sh
set -e

NAME="runat"
# from args
VERSION="${1}"
test ${VERSION} || (echo "Usage: ./release.sh <version>" && 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

0 comments on commit 353fcf5

Please sign in to comment.