service_stop
lib callCapy
function service_stop(unit : string) bool
Description
service_stop() posts a stop and records that the service should stay down. The stop runs ahead of every queued message. The worker runs SERVICE:STOP, if the unit defines it, and exits once it returns; messages still queued are dropped.
A true result records the stop request. It does not wait for SERVICE:STOP or worker exit. A following service_start() can record new start props while the old worker still stops. Use service_status() when the application needs to observe the transition.
A stopped service stays down until the next service_start() or service_send(). Stop and start is also how a service picks up changed source, because the start compiles the unit again.
Parameters
unit : the unit path of the service
Return Values
true when the stop was recorded; false when the unit is unknown
Errors
Lock and state-file failures trap instead of returning false.
A SERVICE:STOP handler that does not return within the invocation deadline is interrupted and the worker is terminated. Stopping a service that is not running only records the state.
Example
Capy
service_stop("/agents/pool.capy")