Hi Zrin,

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

realy nice scripts - is there any chance to share them for public on 
sourceforge ?

Thomas




Von:    Zrin Ziborski <[email protected]>
An:     ASSP development mailing list <[email protected]>
Datum:  07.10.2010 02:00
Betreff:        Re: [Assp-test] Proper shutdown from command line




  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




DISCLAIMER:
*******************************************************
This email and any files transmitted with it may be confidential, legally 
privileged and protected in law and are intended solely for the use of the 

individual to whom it is addressed.
This email was multiple times scanned for viruses. There should be no 
known virus in this email!
*******************************************************


------------------------------------------------------------------------------
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