Skip to content

Commit

Permalink
Update README for post-processing command
Browse files Browse the repository at this point in the history
  • Loading branch information
JPEWdev committed Dec 5, 2018
1 parent 2bf3a3f commit e7e33ab
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tpl/README.md.in
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,35 @@ tini -p SIGTERM -- ...
*NOTE: See [this PR discussion][12] to learn more about the parent death signal
and use cases.*

### Post Processing Commands ###

Tini can be instructed to execute a sequence of commands after the primary
child terminates. These post processing commands can be used to perform cleanup
actions, or remap exit codes. To add a post processing command, use the `-P`
flag. The flag will consume arguments until a lone `;` is encountered. In
addition, an argument of `{}` will be replaced with the numeric exit code of
the last process tini ran. The exit code of the post processing command will be
the new exit code for tini.

```
$ echo -e '#!/bin/sh\nexit $(expr $1 + 1)' > test.sh
$ tini -P test.sh {} ; -- /bin/false
$ exit $?
2
```

*NOTE: The `;` terminator may need to be escaped if executed from a shell*

Multiple post processing command may be specified on the command line. Each one
will be executed in the order listed, and each can be passed the exit code
from the previous one via `{}`.

Post processing commands inherit their signal mask from tini itself, unlike the
child command which gets the default signal mask. This makes them suitable for
unconditionally running uninterruptable commands after the primary command
exits. The post processing commands can always unmask signals if they desire to
be interruptable again.


More
----
Expand Down

0 comments on commit e7e33ab

Please sign in to comment.