*Tamás, thank you for the solution for runit. It is great. But since it 
requires additional configuration/programming on ops side I made my 
choice in favor of panicwrap.*
*I definitely will try it if there will be problems with panicwrap.*

On Thursday, December 15, 2016 at 4:57:17 PM UTC+4, Tamás Gulácsi wrote:
>
> 2016. december 15., csütörtök 13:12:16 UTC+1 időpontban Maksim Sitnikov a 
> következőt írta:
>>
>> Justin, Your suggestion seems to be the only viable solution at the 
>> moment. Thank you.
>>
>> But if there is anything else, will be glad to hear.
>>
>>
> runit has a nice feature: if you have a "finish" executable beside "run", 
> it will be called with the return code of "run".
> If you log into file, then it's easy to have "finish" mail that log to you 
> on panic.
>
> Our finish script begins as:
>
>> #!/bin/sh
>> RC="$1"  # ./runs exit code, or -1 if ./run didnt exit normally
>> ES="$2"  # the least significant byte of the exit status as determined by 
>> waitpid(2)
>>          # for instance it is 0 if ./run exited normally, and the signal 
>> number
>>          # if ./run was terminated by a signal.
>>          # If runsv cannot start ./run for some reason, the
>>          # exit code is 111 and the status is 0.
>> if [ -z "$RC" ]; then
>>     echo "no return code?" >&2
>>     exit 1
>> fi
>>
>
> And could countinue as
>
>> if [ "$RC" -eq 0 ]; then
>>     exit 0
>> fi
>> NAME="$(basename $(pwd))"
>> mail -s "$NAME has exited with $RC" -a /var/log/"$NAME".log dev-of-$
>> na...@example.org <javascript:>
>>
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to