SIGINT handling in runsvdir
Denys Vlasenko
vda.linux at googlemail.com
Mon Mar 2 16:51:56 UTC 2015
On Mon, Mar 2, 2015 at 5:40 AM, Neale Pickett <dartcatcher at gmail.com> wrote:
> You can read it
> at https://woozle.org/neale/g.cgi/aur/runit-init/tree/usr/bin/runit-signal
cleanup () {
echo "Stopping services..."
sv -v stop /var/service/*
echo "Asking processes to exit..."
busybox killall5 -1
busybox killall5 -15
if ! waitall; then
echo "Forcing processes to exit..."
busybox killall5 -9
waitall
fi
echo "Unmounting file systems..."
umount -a -r
# Sometimes when we reach here we still haven't been able to umount
# everything. Not much more we can do about that, other than flush
# write buffers and hope for the best.
sync
}
I suggest adding "sync &" after killall5 -15.
The idea is to initiate cache writeout earlier.
While your processes exit, and you wait for them to disappear,
storage will be already busily writing out all dirty blocks.
If umount hangs (it shouldn't... modulo bugs), having early
sync also would help to have more data saved by this point.
More information about the busybox
mailing list