File : README.md Maintainer : Felix C. Stegerman <firstname.lastname@example.org> Date : 2013-07-20 Copyright : Copyright (C) 2013 Felix C. Stegerman Version : 0.3.1
taskmaster - manage tasks using a Taskfile
Taskmaster  uses a
Taskfile to specify tasks to be run. A
.taskmaster file can be used for additional configuration. You
can specify global or task-specific environments, working
directories, log dirs (w/ log files for STDOUT and STDERR), etc.
You can also set default concurrency here. Tasks that do not have a
log dir, will have their output shown by taskmaster (w/ info and
A task's command can be prefixed w/
SIG* to use that signal to
kill it (instead of
SIGTERM). Some programs, like rackup, will
not respond to
SIGTERM properly when backgrounded, but will quit
nicely when sent a
When using a log dir, the process' STDOUT and STDERR will be
*.sample for configuration examples.
Taskmaster will export
TASK_N=<n> to the
environment of each task. For example, when starting a task named
foo with a concurrency of 2, the first process will have
TASK_N=1 and the second one
You can override which files and shell taskmaster uses by setting
$ cd some/dir $ vim Taskfile .taskmaster # see *.sample $ taskmaster # run, or: $ taskmaster foo=2 bar=1 # run and override concurrency
Now wait for all tasks to finish, or kill taskmaster w/ SIGTERM or SIGINT (^C).
In its default configuration, taskmaster starts some processes, then waits for them to end, or taskmaster to be killed. It can also be used as an erlang-inspired supervisor, which will watch its children and possibly restart them when they die.
temporary(the default) - the process' death is ignored.
transient- will restart the process if its status is non-zero.
permanent- will always restart the process when it dies.
one_for_one(the default) - restarts the process that died.
one_for_all- restarts all processes when one dies.
temporary processes' death will always be ignored and not
result in any restarts, even with the
To prevent runaway restarts, you can specify how many restarts
maxR) are allowed in a time interval (
maxT). When more
restarts occur within this interval, taskmaster will exit. The
default is a
maxR of 10 and a
maxT of 60 (minutes). Restarts
are counted globally, not per task.
CAVEATS: Killing, Background Processes, and Signals
The commands in the
Taskfile are passed to
To prevent runaway background processes, taskmaster will kill the
bash -c process as well as its direct children. Nonetheless, some
care must still be taken.
sleep 42 & will not be killed by taskmaster because
it's parent process (
bash -c) is no longer alive;
sleep 42 &
wait will be killed as expected. Processes w/o parents will also
not play well w/ supervision.
SIGINT sleep 37 will not be killed by the SIGINT, even
though sleep responds to SIGINT when used in an interective shell.
I've done my best to test taskmaster to make sure it works as expected. It seems to. I cannot however guarantee that bad things will not happen. Dealing with processes like this is not entirely trivial. Please test taskmaster yourself before you use it in a production environment. You can report issues and request features at the github issue tracker.
- always send SIGTERM to
- make sure
kill || trueand
wait 2>/dev/nullare OK?
- more efficient implementation of restarts buffer?
- use fifo + SIGUSR2 to allow adding additional workers?
- use ^^^ to scale up/down?
- exitstatus: 0 OK, 1 oops, 2 terminated, 3 max restarts, ...?
- better ways to communicate between master and workers?
- look at possible timing issues?
 Taskmaster --- https://github.com/obfusk/taskmaster
 GNU General Public License, version 2 --- http://www.opensource.org/licenses/GPL-2.0