On 29/09/17 13:57, Michael Stone wrote:
On Fri, Sep 29, 2017 at 01:27:26PM +0100, Matthew Vernon wrote:
timeout should (optionally) emit an error message when the timeout is
reached. This would make debugging a range of issues easier, but my
case in point is ceph, which has, in a service file:

ExecStart=/bin/sh -c 'timeout 120 flock /var/lock/ceph-disk-$(basename
%f) /usr/sbin/ceph-disk --verbose --log-stdout trigger --sync %f'

Currently nothing is logged when this timeout is reached, which made
debugging a startup issue needlessly fiddly. It would be good to have
an option (e.g. --log-on-exit or --verbose or somesuch) which would
make timeout say something like "timeout elapsed, killing ...".

Try ExecStart=/bin/sh -c 'timeout 120 flock /var/lock/ceph-disk-$(basename %f) /usr/sbin/ceph-disk --verbose --log-stdout trigger --sync %f ; RET=$? ; if [ $RET -eq 124 ] ; then echo "Timed out!" ; fi ; return $RET'

Well, yes, one can write wrappers around anything. That doesn't mean it wouldn't be useful if timeout had an option to emit the obviously-useful message itself.

Regards,

Matthew

Reply via email to