Solaris Manifest for vboxwebsrv

zubb13
2013-11-30
2013-11-30
  • zubb13
    zubb13
    2013-11-30

    As mentioned in https://sourceforge.net/p/phpvirtualbox/wiki/Home/#solaris you need to start vboxwebsrv for phpVirtualBox to work. For simplicity I made an SMF manifest to look after this.

    Note I use the user vbox group staff to run my VM's so change this to suit your needs.

    To use, copy the following into a filename of your choosing in /lib/svc/manifest/site and execute svcadm restart manifest-import

    <?xml version="1.0" ?>
    <!DOCTYPE service_bundle
      SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
    <!--
        Manifest created by svcbundle (2013-Nov-30 11:25:42+1100)
    -->
    <service_bundle type="manifest" name="application/vboxwebserver">
        <service version="1" type="service" name="application/vboxwebserver">
            <!--
                The following dependency keeps us from starting until the
                multi-user milestone is reached.
            -->
            <dependency restart_on="none" type="service"
                name="multi_user_dependency" grouping="require_all">
                <service_fmri value="svc:/milestone/multi-user"/>
            </dependency>
            <exec_method timeout_seconds="60" type="method" name="start"
                exec="/opt/VirtualBox/vboxwebsrv -b --logfile /export/home/vbox/vboxwebsrv.log">
                <method_context>
                   <method_credential user="vbox" group="staff" privileges="basic" />
                </method_context>
            </exec_method>
            <!--
                The exec attribute below can be changed to a command that SMF
                should execute to stop the service.  See smf_method(5) for more
                details.
            -->
            <exec_method timeout_seconds="60" type="method" name="stop"
                exec=":kill">
                <method_context>
                   <method_credential user="vbox" group="staff" privileges="basic" />
                </method_context>
            </exec_method>
            <!--
                The exec attribute below can be changed to a command that SMF
                should execute when the service is refreshed.  Services are
                typically refreshed when their properties are changed in the
                SMF repository.  See smf_method(5) for more details.  It is
                common to retain the value of :true which means that SMF will
                take no action when the service is refreshed.  Alternatively,
                you may wish to provide a method to reread the SMF repository
                and act on any configuration changes.
            -->
            <exec_method timeout_seconds="60" type="method" name="refresh"
                exec=":true">
                <method_context>
                   <method_credential user="vbox" group="staff" privileges="basic" />
                </method_context>
            </exec_method>
    
            <instance enabled="true" name="default"/>
            <template>
                <common_name>
                    <loctext xml:lang="C">
                       VirtualBox WebServer
                    </loctext>
                </common_name>
                <description>
                    <loctext xml:lang="C">
                        Starts the VirtualBox WebServer for phpVirtualBox
                    </loctext>
                </description>
            </template>
        </service>
    </service_bundle>