<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>

<!--
Copyright 2008 Sam Falkner

CDDL HEADER START

The contents of this file are subject to the terms of the
Common Development and Distribution License (the "License").
You may not use this file except in compliance with the License.

You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
or http://www.opensolaris.org/os/licensing.
See the License for the specific language governing permissions
and limitations under the License.

When distributing Covered Code, include this CDDL HEADER in each
file and include the License file at usr/src/OPENSOLARIS.LICENSE.
If applicable, add the following below this CDDL HEADER, with the
fields enclosed by brackets "[]" replaced with your own identifying
information: Portions Copyright [yyyy] [name of copyright owner]

CDDL HEADER END

to use this service:
copy this file into /var/svc/manifest/application/dtsyslog
# svccfg import /var/svc/manifest/application/dtsyslog
# svccfg
svccfg> select dtsyslog
svccfg> editprop
set the path to the script that you want to run
svccfg> exit
# svcadm refresh dtsyslog
# svcadm enable dtsyslog

Look at other properties in "svccfg editprop" too!  Create more
instances to have more than one script running.  Use "svcadm disable ..."
to disable when no longer needed.  Enjoy!

-->

<service_bundle type='manifest' name='dtsyslog-service'>
    <service
	name='application/dtsyslog'
	type='service'
	version='1'>

	<create_default_instance enabled='false' />

	<dependency
	    name='syslogd'
	    grouping='require_all'
	    restart_on='error'
	    type='service'>
	    <service_fmri value='svc:/system/system-log' />
	</dependency>

	<dependent
	    name='dtsyslog-multiuser'
	    grouping='optional_all'
	    restart_on='none'>
	    <service_fmri value='svc:/milestone/multi-user' />
	</dependent>

	<method_context>
	    <method_credential
		user='daemon'
		privileges='basic,dtrace_kernel'
		/>
	</method_context>

	<exec_method
	    type='method'
	    name='start'
	    exec='sh -c "dtrace %{script/options} -s %{script/path} | logger -p %{syslog/priority} -t %{syslog/tag}"'
	    timeout_seconds='0'>
	</exec_method>

	<exec_method
	    type='method'
	    name='stop'
	    exec=':kill'
	    timeout_seconds='4'>
	</exec_method>

	<property_group
	    name='startd'
	    type='framework'>
	    <propval
		name='duration'
		type='astring'
		value='child' />
	</property_group>

	<property_group
	    name='script'
	    type='application'>
	    <propval
		name='options'
		type='astring'
		value='' />
	    <propval
		name='path'
		type='astring'
		value='/path/to/D/script' />
	</property_group>

	<property_group
	    name='syslog'
	    type='application'>
	    <propval
		name='priority'
		type='astring'
		value='daemon.notice' />
	    <propval
		name='tag'
		type='astring'
		value='dtsyslog' />
	</property_group>

	<template>
	    <common_name>
		<loctext xml:lang='C'>dtsyslog daemon</loctext>
	    </common_name>
	</template>
    </service>
</service_bundle>
