/** * service_start_dynamic - Start new or reload modified dynamic services */ void service_start_dynamic(void) { svc_t *svc; _d("Starting enabled/added services ..."); for (svc = svc_dynamic_iterator(1); svc; svc = svc_dynamic_iterator(0)) { if (svc_is_updated(svc)) svc_dance(svc); } /* Cleanup stale services */ svc_clean_dynamic(service_unregister); }
/** * service_stop_dynamic - Stop disabled/removed dynamic services */ void service_stop_dynamic(void) { svc_t *svc; _d("Stopping disabled/removed services ..."); for (svc = svc_dynamic_iterator(1); svc; svc = svc_dynamic_iterator(0)) { if (svc_is_changed(svc)) service_stop(svc); } _d("All disabled/removed services have been stoppped, calling reconf hooks ..."); plugin_run_hooks(HOOK_SVC_RECONF); /* Reconfigure HW/VLANs/etc here */ }
/** * service_stop_dynamic - Stop disabled/removed dynamic services * * We call it "stop", but in reality it could be "skip" as well, if the * service supports SIGHUP. This function is just one step on the road * to reload all modified services. */ void service_stop_dynamic(void) { svc_t *svc; _d("Stopping disabled/removed services ..."); for (svc = svc_dynamic_iterator(1); svc; svc = svc_dynamic_iterator(0)) { if (svc_is_changed(svc) && svc->pid) { svc_state_t new_state = SVC_RELOAD_STATE; if (svc_is_removed(svc)) new_state = SVC_HALTED_STATE; if (!svc_has_sighup(svc)) dyn_stop_cnt++; _d("Marking service %s as state %d", svc->cmd, new_state); service_stop(svc, new_state); } } /* Check if we need to collect any services before calling user HOOK */ service_stop_done(NULL); }