Re: 'svc -d' doesn't wait for exit

Daryl Tester <[email protected]>
Newsgroups gmane.comp.djb.syslog
Message-ID <[email protected]>
Brian Reichert wrote:

>>> Is there a preferred mechanism to accomplish this, other than a
>>> busy-wait on checking the output of 'svstat'?

>> That's the simplest way.

> So I figured; thanks for the reply...

My stop script for supervised processes under FreeBSD
currently looks like this -

stop)
        # Stop supervised processes, then their log daemons.
        svc -d /service/*
        COUNT=10
        # Loop to ensure all processes went down.
        while svstat /service/* | grep ': up ' > /dev/null
        do
            COUNT=$(expr $COUNT - 1)
            [ $COUNT -eq 0 ] && break
            sleep 5
        done
        if svstat /service/* | grep ': up ' > /dev/null
        then
            # Note: possible race - not life threatening.
            echo "Services still up:"
            svstat /service/*
        fi
        # Drop the logging daemons regardless (we may lose output)
        svc -d /service/*/log
        ;;


-- 
Regards,
  Daryl Tester, IOCANE Pty. Ltd.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.