<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
	music.xml - Background Music Service.
	            written for SMF (Solaris 10).

	This plays some relaxing background music on a constant loop. 
	It keeps the audio driver entertained, and can make your servers
	appear more important and high-tech (beeping servers are special).

	24-Nov-2005, ver 1

	INSTALL:
		cp music.xml /var/svc/manifest/site
		svccfg import /var/svc/manifest/site/music.xml
		svcadm enable music

	USAGE:
		svcadm enable music	# turn on music
		svcadm disable music	# turn off music
		svcs music		# status of music

	SETTING VOLUME:
		svccfg -s music setprop application/volume=50	# set to 50%
		svcadm refresh music
		
	NOTE: You do need an audio device for this to work. Most of Sun's
		servers do have them (a tradition I hope to encourage!).

	Standard Disclaimer: this is freeware, use at your own risk.

	HISTORY:
		24-Nov-2005	Brendan Gregg	Created this.
-->

<service_bundle type='manifest' name='brendan:music'>

<service
	name='site/music'
	type='service'
	version='1'>

	<create_default_instance enabled='false' />

	<single_instance />

	<dependency name='fs-local'
		grouping='require_all'
		restart_on='none'
		type='service'>
		<service_fmri
			value='svc:/system/filesystem/local' />
	</dependency>

	<dependency name='music_data'
		grouping='require_all'
		restart_on='restart'
		type='path'>
		<service_fmri
		    value='file://localhost/usr/demo/SOUND/sounds/computer.au'
		/>
	</dependency>

	<dependency name='audio_card'
		grouping='require_all'
		restart_on='restart'
		type='path'>
		<service_fmri
		    value='file://localhost/dev/audio' />
	</dependency>

	<exec_method
		type='method'
		name='start'
		exec='sh -c "
			while :;
				do /usr/bin/audioplay -v %{volume} %{file};
			done &amp;
		"'
		timeout_seconds='90'/>

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

	<exec_method
		type='method'
		name='refresh'
		exec=':kill'
		timeout_seconds='90' />

        <property_group name='application' type='application'>
                <propval name='volume' type='count' value='20' />
                <propval name='file' type='astring' 
		    value='/usr/demo/SOUND/sounds/computer.au'
		/>
        </property_group>

	<stability value='Unstable' />

	<template>
		<common_name>
			<loctext xml:lang='C'>
			Background Music Service
			</loctext>
		</common_name>
	</template>

</service>

</service_bundle>
