@@ -82,6 +82,7 @@ function enable_autostart() {
8282function disable_supervisord ( ) {
8383 dbg . log0 ( `disable_supervisord` ) ;
8484 let services ;
85+ let supervisord_pids ;
8586 return P . join (
8687 promise_utils . exec ( `${ SUPERCTL } status | grep pid | sed 's:.*pid \\(.*\\), uptime.*:\\1:'` , {
8788 ignore_rc : false ,
@@ -99,9 +100,17 @@ function disable_supervisord() {
99100 ignore_rc : false ,
100101 return_stdout : true ,
101102 } ) ,
103+ promise_utils . exec ( 'ps axf | ' +
104+ 'grep -e supervisord | ' +
105+ 'grep -v grep | ' +
106+ "awk '{print $1}'" , {
107+ ignore_rc : false ,
108+ return_stdout : true ,
109+ } ) ,
102110 )
103- . spread ( ( super_services , detached_services ) => {
104- services = _ . uniq ( _ . concat ( super_services . split ( '\n' ) , detached_services . split ( '\n' ) ) ) ;
111+ . spread ( ( super_services , detached_services , supervisord_pid ) => {
112+ supervisord_pids = _ . compact ( supervisord_pid . split ( '\n' ) ) ;
113+ services = _ . compact ( _ . uniq ( _ . concat ( super_services . split ( '\n' ) , detached_services . split ( '\n' ) ) ) ) ;
105114 dbg . log0 ( 'disable_supervisord services pgids:' , services ) ;
106115 } )
107116 . then ( ( ) => promise_utils . exec ( `${ SUPERCTL } shutdown` , {
@@ -112,6 +121,17 @@ function disable_supervisord() {
112121 . then ( ( ) => {
113122 dbg . log0 ( 'disable_supervisord shutdown' ) ;
114123 } )
124+ . then ( ( ) => P . map ( supervisord_pids , super_pid => {
125+ if ( super_pid ) {
126+ dbg . log0 ( `Killing supervisord pgid:${ super_pid } ` ) ;
127+
128+ return promise_utils . exec ( `kill -9 -${ super_pid } ` , {
129+ ignore_rc : true ,
130+ return_stdout : true ,
131+ trim_stdout : true
132+ } ) ;
133+ }
134+ } ) )
115135 . then ( ( ) => P . map ( services , service => {
116136 if ( service ) {
117137 dbg . log0 ( `Killing pgid:${ service } ` ) ;
0 commit comments