small bug fix

This commit is contained in:
will Farrell 2017-02-12 21:08:45 -07:00
parent 562ea8e433
commit 5507ffd878
2 changed files with 7 additions and 9 deletions

View File

@ -22,12 +22,12 @@ A great project, don't get me wrong. It was just missing certain key enterprise
- Ability to trigger scripts in other containers on completion cron job using `trigger`. - Ability to trigger scripts in other containers on completion cron job using `trigger`.
## Config.json ## Config.json
- `comment`: Comments to be included with crontab entry - `comment`: Comments to be included with crontab entry. Optional.
- `schedule`: Crontab schedule syntax as described in https://godoc.org/github.com/robfig/cron. Ex `@hourly`, `@every 1h30m`, `* * * * * *`. Required. - `schedule`: Crontab schedule syntax as described in https://godoc.org/github.com/robfig/cron. Ex `@hourly`, `@every 1h30m`, `* * * * * *`. Required.
- `command`: Command to be run on docker container/image. Required. - `command`: Command to be run on docker container/image. Required.
- `image`: Docker images name (ex `library/alpine:3.5`). Optional. - `image`: Docker images name (ex `library/alpine:3.5`). Optional.
- `project`: Docker Compose/Swarm project name. Optional, only applies when `contain` is included. - `project`: Docker Compose/Swarm project name. Optional, only applies when `contain` is included.
- `container`: Full container name or container alias if `project` is set. Ignored if `image` is included. - `container`: Full container name or container alias if `project` is set. Ignored if `image` is included. Optional.
- `dockerargs`: Command line docker `run`/`exec` arguments for full control. Defaults to ` `. - `dockerargs`: Command line docker `run`/`exec` arguments for full control. Defaults to ` `.
- `trigger`: Array of docker-crontab subset objects. Subset includes: `image`,`project`,`container`,`command`,`dockerargs` - `trigger`: Array of docker-crontab subset objects. Subset includes: `image`,`project`,`container`,`command`,`dockerargs`

View File

@ -47,14 +47,12 @@ EOF
} }
make_cmd() { make_cmd() {
IMAGE=$(echo ${1} | jq -r .image) if [ "$(echo ${1} | jq -r .image)" != "null" ]; then
CONTAINER=$(echo ${1} | jq -r .container) make_image_cmd "$1"
if [ "${IMAGE}" != "null" ]; then elif [ "$(echo ${1} | jq -r .container)" != "null" ]; then
make_image_cmd make_container_cmd "$1"
elif [ "${CONTAINER}" != "null" ]; then
make_container_cmd
else else
echo "echo 'Error making docker command, image or container param missing.'" echo ${1} | jq -r .command
fi fi
} }