File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2873,8 +2873,12 @@ int service_step(svc_t *svc)
28732873 if (svc_is_removed (svc ) && svc_has_cleanup (svc )) {
28742874 svc_set_state (svc , SVC_CLEANUP_STATE );
28752875 service_cleanup_script (svc );
2876- } else
2876+ } else {
2877+ /* Unblock remain tasks after post script so they can restart */
2878+ if (svc_is_remain (svc ))
2879+ svc_unblock (svc );
28772880 svc_set_state (svc , SVC_HALTED_STATE );
2881+ }
28782882 }
28792883 break ;
28802884
Original file line number Diff line number Diff line change @@ -461,6 +461,9 @@ void sm_step(void)
461461 /* First reload all *.conf in /etc/finit.d/ */
462462 conf_reload ();
463463
464+ /* Handle remain tasks that need to run post script before restart */
465+ service_runtask_clean ();
466+
464467 /*
465468 * Then, mark all affected service conditions as in-flux and
466469 * let all affected services move to WAITING/HALTED
Original file line number Diff line number Diff line change @@ -344,6 +344,10 @@ svc_t *svc_stop_completed(void)
344344 for (svc = svc_iterator (& iter , 1 ); svc ; svc = svc_iterator (& iter , 0 )) {
345345 if (svc -> state == SVC_STOPPING_STATE && svc -> pid > 1 )
346346 return svc ;
347+
348+ /* Also wait for remain tasks running their post script */
349+ if (svc_is_remain (svc ) && svc -> state == SVC_TEARDOWN_STATE && svc -> pid > 1 )
350+ return svc ;
347351 }
348352
349353 return NULL ;
You can’t perform that action at this time.
0 commit comments