Skip to content

mh-cbon/cct

Repository files navigation

cct

travis Status appveyor Status Go Report Card GoDoc MIT License

Package cct is a cli program to run concurrent command lines

TOC

Install

Check the release page!

go

go get github.com/mh-cbon/cct

linux rpm/deb repository

wget -O - https://raw.githubusercontent.com/mh-cbon/latest/master/source.sh \
| GH=mh-cbon/cct sh -xe
# or
curl -L https://raw.githubusercontent.com/mh-cbon/latest/master/source.sh \
| GH=mh-cbon/cct sh -xe

linux rpm/deb standalone package

curl -L https://raw.githubusercontent.com/mh-cbon/latest/master/install.sh \
| GH=mh-cbon/cct sh -xe
# or
wget -q -O - --no-check-certificate \
https://raw.githubusercontent.com/mh-cbon/latest/master/install.sh \
| GH=mh-cbon/cct sh -xe

Cli

cct

cct is a cli program to run concurrent command lines

Usage

$ cct -version

Show version

$ cct -help

Show this help

$ cct -add|-a [-timeout n] $bucket $cmd

Add $cmd to given $bucket

$ cct -wait|-w [-verbose] [-keep|-k] [-immediate|-i] [-json|-j] $bucket

Wait for <bucket> commands completion, prints command results.
When a command of the bucket is finished and queried, it is removed.

-immediate: prevent the program to wait for bucket completion before returning.
-keep: prevent the program to remove finished commands of the bucket being queried.

$ cct -backend [-verbose] [-timeout n]

Start the backend to execute commands concurrently.

The backend automatically exits after duration <n> when
- tasks list is empty
- tasks are finished

The backend watches for all http activities and delay the timeout.

-timeout n: duration length before the backend exits automatically.

Example

add tasks to bucket 1

cct -add -timeout 2 1 sleep 2
cct -a 1 sleep 10
cct -a 1 sleep 5

Note: using a one liner syntax would result in a totally different result!

cct -a 1 sleep 10;cct -a 1 sleep 10

wait completion of the bucket 1

cct -wait 1

This command will wait for the completion of all three commands added to the bucket 1

cct -w 1

Running the command again will return immediately, the response is an empty list as the bucket 1 was flushed by the previous call.

query status of the bucket 1

cct -w -k -i -j 1

Use [-keep|-k] and [-immediate|-i] options to only query the status of every commands in the bucket 1.

Those options prevent the bucket to be emptied.

Use [-json|-j] option to return a JSON obect of []Task.

Release the project

gump patch -d # check
gump patch # bump

History

CHANGELOG