1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
|
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
#
# Copyright 2016-2024 Jim Klimov
# NDE (nut-driver-enumerator) manages definitions of instantiated NUT drivers
#
-->
<service_bundle type='manifest' name='nut-driver-enumerator'>
<service name='system/power/nut-driver-enumerator' type='service' version='2'>
<!--
Wait for all local and usr filesystem to be mounted - project is
usually located in /usr/sbin.
-->
<dependency
name='fs-local'
type='service'
grouping='require_all'
restart_on='none'>
<service_fmri value='svc:/system/filesystem/local' />
</dependency>
<dependency
name='filesystem-usr'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri
value='svc:/system/filesystem/usr:default'/>
</dependency>
<dependency
name='config-files'
type='path'
grouping='require_all'
restart_on='refresh'>
<service_fmri value='file://localhost@CONFPATH@/ups.conf' />
</dependency>
<!--
Prerequisite for NUT upsd to be started, if it's enabled
Note that drivers are optional: if one fails to start, do not block
the upsd from publishing others. While this script will start and
stop (and define/undefine) services for the drivers, based on the
changes in ups.conf, such changes also need to reflect in nut-server
so it would know that it republishes a changed list of drivers.
-->
<dependent
name='nut-daemon-service'
grouping='optional_all'
restart_on='error'>
<service_fmri value='svc:/system/power/nut-server' />
</dependent>
<instance name='default' enabled='false'>
<!--
There can be only one...
-->
<dependency name='enumerator_daemon' grouping='exclude_all' restart_on='none' type='service'>
<service_fmri value='svc:/system/power/nut-driver-enumerator:daemon'/>
</dependency>
<!--
The nut-driver-enumerator start/stop methods for single-fire variant.
-->
<exec_method
type='method'
name='start'
exec='@NUT_LIBEXECDIR@/nut-driver-enumerator.sh'
timeout_seconds='0'>
<method_context>
<method_environment>
<envvar name='REPORT_RESTART_42' value='no'/>
</method_environment>
</method_context>
</exec_method>
<exec_method
type='method'
name='refresh'
exec='@NUT_LIBEXECDIR@/nut-driver-enumerator.sh'
timeout_seconds='0'>
<method_context>
<method_environment>
<envvar name='REPORT_RESTART_42' value='no'/>
</method_environment>
</method_context>
</exec_method>
<!-- a :KILL does not really apply to a transient service... -->
<exec_method
type='method'
name='stop'
exec='/bin/true'
timeout_seconds='60' />
<property_group name='startd' type='framework'>
<!--
Sub-process core dumps and external kill signals are not
considered errors, so the service should be restarted.
-->
<propval name='ignore_error' type='astring'
value='core,signal' />
<propval name='duration' type='astring' value='transient' />
</property_group>
<property_group name='general' type='framework'>
<propval name='package' type='astring' value='NUT'/>
</property_group>
<template>
<common_name>
<loctext xml:lang='C'>
NUT power device driver instance enumerator (generates nut-driver:* instances)
</loctext>
</common_name>
<documentation>
<doc_link name='upsdrvsvcctl online' uri='@NUT_WEBSITE_BASE@/docs/man/upsdrvsvcctl.html' />
<manpage title='upsdrvsvcctl' section='@MAN_SECTION_CMD_SYS@' manpath='@NUT_MANDIR@' />
<doc_link name='ups.conf online' uri='@NUT_WEBSITE_BASE@/docs/man/ups.conf.html' />
<manpage title='ups.conf' section='@MAN_SECTION_CFG@' manpath='@NUT_MANDIR@' />
<doc_link name='nut.conf online' uri='@NUT_WEBSITE_BASE@/docs/man/nut.conf.html' />
<manpage title='nut.conf' section='@MAN_SECTION_CFG@' manpath='@NUT_MANDIR@' />
</documentation>
</template>
</instance>
<instance name='daemon' enabled='false'>
<!--
There can be only one...
-->
<dependency name='enumerator_default' grouping='exclude_all' restart_on='none' type='service'>
<service_fmri value='svc:/system/power/nut-driver-enumerator:default'/>
</dependency>
<!--
The nut-driver-enumerator start/stop methods for infinite loop variant.
-->
<exec_method
type='method'
name='start'
exec='@NUT_LIBEXECDIR@/nut-driver-enumerator.sh --daemon-after'
timeout_seconds='0'>
<method_context>
<method_environment>
<envvar name='REPORT_RESTART_42' value='no'/>
</method_environment>
</method_context>
</exec_method>
<exec_method
type='method'
name='refresh'
exec=':kill -SIGHUP'
timeout_seconds='0'/>
<exec_method
type='method'
name='stop'
exec=':kill'
timeout_seconds='60' />
<property_group name='startd' type='framework'>
<!--
Sub-process core dumps and external kill signals are not
considered errors, so the service should be restarted.
-->
<propval name='ignore_error' type='astring'
value='core,signal' />
<propval name='duration' type='astring' value='contract' />
</property_group>
<property_group name='general' type='framework'>
<propval name='package' type='astring' value='NUT'/>
</property_group>
<template>
<common_name>
<loctext xml:lang='C'>
NUT power device driver instance enumerator (generates nut-driver:* instances and keeps watch of ups.conf in a loop)
</loctext>
</common_name>
<documentation>
<doc_link name='upsdrvsvcctl online' uri='@NUT_WEBSITE_BASE@/docs/man/upsdrvsvcctl.html' />
<manpage title='upsdrvsvcctl' section='@MAN_SECTION_CMD_SYS@' manpath='@NUT_MANDIR@' />
<doc_link name='ups.conf online' uri='@NUT_WEBSITE_BASE@/docs/man/ups.conf.html' />
<manpage title='ups.conf' section='@MAN_SECTION_CFG@' manpath='@NUT_MANDIR@' />
<doc_link name='nut.conf online' uri='@NUT_WEBSITE_BASE@/docs/man/nut.conf.html' />
<manpage title='nut.conf' section='@MAN_SECTION_CFG@' manpath='@NUT_MANDIR@' />
</documentation>
</template>
</instance>
<!-- Really unstable - this service should be evolved! -->
<stability value='Unstable' />
</service>
</service_bundle>
|