Am 06.10.2010 22:10, schrieb Mark Edwards:
> The init.d script that I installed as part of my ASSP 2.0.1(1.1.28) 
> configuration contains the following command for stopping assp.pl:
>
> kill -9 `ps ax | grep "perl assp.pl" | grep -v grep | awk '{ print $1 }'`
>
> kill -9 seems like a nuclear method.  Is there a good way to gracefully shut 
> down ASSP from the command line, or does this have to be done from the web 
> interface?

well, you can try to "stop worrying and start loving the bomb", ;)
or ...

HPORT='mx1.example.com'
LOGIN='root:*password*'
TERM_TIMEOUT=60

function stop_assp()
{
        if wget -q 'https://'"$lo...@$hport"'/shutdown_frame?action= Proceed ' 
-O /dev/null; then
                log 'successfully sent shutdown signal to ASSP'
        else
                log 'failed to send shutdown signal to ASSP: code '"$?"
        fi
}

function bailout()
{
        pid="$(ps ax | grep "perl assp.pl" | grep -v grep | awk '{ print $1 }')"
        if [[ -n "$pid" ]]; then
                log "sending TERM to ASSP (pid $pid) and waiting up to 
${TERM_TIMEOUT}s"
                kill -15 "$pid"
                for (( i=0; i<=$TERM_TIMEOUT; i+=5 )); do
                        sleep 5
                        ps -fp "$pid" | grep -q assp || break
                done
                if ps -fp "$pid" | grep -q assp; then
                        log "killing ASSP (pid $pid)"
                        kill -9 "$pid"
                        sleep 5
                fi
        fi
}

(see an example @ http://blog.ziborski.net/e-mail/upstart-assp/)

HTH,
Zrin


------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Assp-test mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/assp-test

Reply via email to