sh 'sleep' and trap?
kraduk at gmail.com
Wed Jul 16 09:55:53 UTC 2014
send a kill to the script and then to the sleep process itself?
On 16 July 2014 10:31, Karl Pielorz <kpielorz_lst at tdx.co.uk> wrote:
> Hi All,
> I have a script, similar to this:
> echo $$ >/var/run/mypid.pid
> trap "rm /var/run/mypid.pid; exit 0" EXIT
> while [ 1 ]
> sleep 60
> This works - but an attempt to 'kill' it, e.g.
> kill `head -1 /var/run/mypid.pid`
> Takes up to 60 seconds, before 'sleep' completes, control returns back to
> the shell - which see's the signal, and quits.
> Is there a better way of doing this? - i.e. some way the shell can 'pass
> time' but still receive signals in a timely manner?
> The only work around I could come up with was to change the 'sleep 60'
> into a loop that does 60 * 1 second sleeps, not ideal though :(
> freebsd-questions at freebsd.org mailing list
> To unsubscribe, send any mail to "freebsd-questions-
> unsubscribe at freebsd.org"
More information about the freebsd-questions