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
|
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
#
# Copyright 2016-2017 Jim Klimov
# Service for common startup or shutdown of NUT-related services
#
-->
<service_bundle type='manifest' name='nut'>
<service name='system/power/nut' type='service' version='1'>
<!--
Configure a default instance for the service since it doesn't
require additional configuration intervention before it starts.
-->
<create_default_instance enabled='true' />
<!--
Not all deployments have both the drivers+data server and client
on the same box, so this service only triggers whatever is enabled
and waits for other system resources according to dependencies of
those actual services.
-->
<dependency
name='syslog'
grouping='optional_all'
restart_on='error'
type='service'>
<service_fmri value='svc:/system/power/nut-server:default'/>
<service_fmri value='svc:/system/power/nut-monitor:default'/>
</dependency>
<!--
The nut start/stop methods.
-->
<!-- The startup is expected to trigger enabled dependency services
and not-trigger those which were not administratively enabled.
There is nothing to do by itself, so it is not-persistent. -->
<exec_method
type='method'
name='start'
exec='/bin/true'
timeout_seconds='60'/>
<!-- The shutdown temporarily-disables all components (if they were
enabled and running in the first place, no-op otherwise) -->
<exec_method
type='method'
name='stop'
exec='/usr/sbin/svcadm disable -ts svc:/system/power/nut-monitor:default || /bin/true ; /usr/sbin/svcadm disable -ts svc:/system/power/nut-server:default || /bin/true ; @SBINDIR@/upsdrvsvcctl stop || /bin/true ; /bin/true'
timeout_seconds='120' />
<!-- When users "refresh nut" they are likely interested in a new
config being applied (currently calls NDE for drivers, if they
and the script/service are installed on the current system),
and refreshing the other services... -->
<exec_method
type='method'
name='refresh'
exec='/usr/sbin/svcadm refresh svc:/system/power/nut-driver-enumerator:default || /usr/sbin/svcadm refresh svc:/system/power/nut-driver-enumerator:daemon || @NUT_LIBEXECDIR@/nut-driver-enumerator.sh || /bin/true; /usr/sbin/svcadm refresh svc:/system/power/nut-monitor:default || /bin/true ; /usr/sbin/svcadm refresh svc:/system/power/nut-server:default || /bin/true'
timeout_seconds='0'/>
<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' />
<!--
A transient service executes the start method once and does
not execute it again if the method exits with $SMF_EXIT_OK.
-->
<propval name='duration' type='astring' value='transient' />
</property_group>
<!-- Really unstable - this service should be evolved! -->
<stability value='Unstable' />
<template>
<common_name>
<loctext xml:lang='C'>
Service for common startup or shutdown of NUT-related services
</loctext>
</common_name>
<documentation>
<manpage title='upsdrvctl' section='@MAN_SECTION_CMD_SYS@' manpath='@NUT_MANDIR@' />
<manpage title='upsd' section='@MAN_SECTION_CMD_SYS@' manpath='@NUT_MANDIR@' />
<manpage title='ups.conf' section='@MAN_SECTION_CFG@' manpath='@NUT_MANDIR@' />
<manpage title='upsd.conf' section='@MAN_SECTION_CFG@' manpath='@NUT_MANDIR@' />
<manpage title='upsd.users' section='@MAN_SECTION_CFG@' manpath='@NUT_MANDIR@' />
</documentation>
</template>
</service>
</service_bundle>
|