Re: Timeout for a script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Jussi Hirvi wrote:
Thanks - but I couldn't make that work as expected. It seems to kill
*something*, but after that, the rsync part still continues in the
background... Here's my last test:

log='/root/log/rsync2'
timeoutseconds=1
pid=$$
(sleep $timeoutseconds;
    echo `date '+%c'` " $0 INTERRUPTED" >>$log;
    kill -9 $pid) &
/usr/bin/rsync -avzu --delete /root /home/palvelimet/bckserver1
echo `date '+%c'` " $0 valmis" >>$log


Try replacing the 'kill -9 $pid' with '/usr/bin/kill -s KILL -$pid'

I've used something based on:

<http://www.splode.com/~friedman/software/scripts/src/with-timeout>

which seems to work fine

James Pearson
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux