The service resource type is used to manage running services on a target system. Because service support varies by platform, providing more information in the resource attributes helps ensure correct behavior.
Handling Services without Status Commands
If a service's init script lacks a working status command, you must:
- Set
hasstatus => false. - Either specify a custom command using the
status attribute or rely on Puppet to search the process table using the pattern attribute.
Refreshing Services
service resources can respond to refresh events (via notify, subscribe, or the ~> arrow). When a service receives a refresh event, Puppet will restart it. The restart method follows this priority:
- If
hasrestart => true, Puppet uses the init script's restart command. - If the
restart attribute is explicitly provided, Puppet uses that command. - Otherwise, Puppet uses the service's
stop and start commands.