<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type="manifest" name="weewx">
    <service name="service/weewx" type="service" version="1">
        <create_default_instance enabled="false"/>
        <single_instance/>

        <dependency 
	    name="network" 
	    grouping="require_all" 
	    restart_on="error" 
	    type="service">
		<service_fmri value="svc:/milestone/network:default"/>
        </dependency>

        <dependency 
	    name="fs-local" 
	    grouping="require_all" 
	    restart_on="error" 
	    type="service">
		<service_fmri value="svc:/system/filesystem/local"/>
        </dependency>
        <!-- 
        If autofs is enabled, wait for it to get users' home 
        directories. 
        --> 
        <dependency 
                name='fs-autofs' 
                grouping='optional_all' 
                restart_on='error' 
                type='service'> 
                        <service_fmri value='svc:/system/filesystem/autofs'/> 
        </dependency> 
        <!-- 
                other dependencies, to try to get this to work
        --> 
        <dependency name="fs-usr" grouping="require_all" restart_on="error" type="service">
                <service_fmri value="svc:/system/filesystem/usr"/>
        </dependency>
        <dependency name="multiuser" grouping="require_all" restart_on="error" type="service">
                <service_fmri value="svc:/milestone/multi-user"/>
        </dependency>

        <exec_method 
	    type="method" 
	    name="start" 
            exec="/home/weewx/bin/weewxd --daemon /home/weewx/weewx.conf --pidfile=/tmp/weewx.pid" 
	    timeout_seconds="60">
                <method_context>
                       <method_credential user="weewx" group="staff"/>
               </method_context>
        </exec_method>

        <exec_method 
	    type="method" 
	    name="stop" 
	    exec=":kill" 
	    timeout_seconds="15">
        </exec_method>

        <property_group name="startd" type="framework">
            <propval name="ignore_error" type="astring" value="core,signal"/>
        </property_group>

        <stability value="Evolving"/>

        <template>
            <common_name>
                <loctext xml:lang="C">
                    WeeWX Weather Server and Publisher
                </loctext>
            </common_name>
            <documentation>
                <doc_link name='WeeWX' uri='http://www.weewx.com'/>
            </documentation>
        </template>

    </service>
</service_bundle>
