tryto runs and watches prog, feeding its standard input to prog’s standard input. If prog exits with a return code other then 0, tryto runs prog again after sleeping one second.
If the number of retries reaches the maximal number of tries, tryto prints an error message and gives up.
If the timeout sec seconds is reached and prog is still running, tryto sends a TERM signal to prog, waits ksec seconds for prog to terminate, then sends a KILL signal if prog still is there, and exits as soon as possible.
Before starting prog, tryto moves the filedescriptor 5 to 2, so all error messages from tryto and prog will be saved in svlogd(8)’s state to be processed on the next run of tryto -p.
After starting prog, tryto first feeds all data it reads from filedescriptor 4 into prog’s standard input, then all data from filedescriptor 0.
If prog fails by timeout sec seconds or maximal number of tries, tryto prints all data from standard input to standard output, an error message to standard error, and exits with 0.
If tryto runs as a svlogd(8) processor, tryto returns 0 in all other cases.
If prog was run successfully, tryto returns 0.
If prog failed by timeout, tryto returns 100.
If prog failed by maximal number of tries, tryto returns the last return code from prog.
http://smarden.org/socklog/
http://smarden.org/runit/