[ann] cct: run concurrent command lines

55 views
Skip to first unread message

mhh...@gmail.com

unread,
Apr 22, 2017, 1:11:01 PM4/22/17
to golang-nuts
hi!

yet another small cli utility you might find useful if you work cross environments,

cct lets you run multiple commands concurrently, then wait for their completion.

where the two interesting commands are

$ cct -add $bucket $cmd

$ cct -wait [-verbose] [-keep] [-immediate] [-json] $bucket


example,

cct -add 1 ls -al
cct -add 1 sleep 10
cct -add 1 sleep 5
cct -wait -json -keep -immediate 1
cct -wait 1

It certainly was a pretext to play with channels :p

It works by attaching cmds to a bucket,
then this bucket is studied to know when its time to exit.

The program spawns an http server in the backend, that one runs in background, it is able to auto exit,
it is responsible to execute the commands.
The add commands just do a POST http request on the backend for queuing, it returns immediately.
The wait command queries the task to the http backend, then returns it.
When you don t use -immediate, it block until all cmds finished.
When you combine -immediate -keep -json you can have a report status
of the various processes being run in the bucket.
If you don t provide -json, it just shows tasks output.

its here https://github.com/mh-cbon/cct!
Reply all
Reply to author
Forward
0 new messages