Skip to content

Instantly share code, notes, and snippets.

@arekinath
Created August 17, 2012 02:47
Show Gist options
  • Save arekinath/3375472 to your computer and use it in GitHub Desktop.
Save arekinath/3375472 to your computer and use it in GitHub Desktop.
Run script at bootup
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type="manifest" name="runscript">
<service name="runscript" type="service" version="1.0.0">
<create_default_instance enabled="true"/>
<single_instance/>
<dependency name="network" grouping="require_all" restart_on="error" type="service">
<service_fmri value="svc:/milestone/network:default"/>
</dependency>
<dependency name="filesystem" grouping="require_all" restart_on="error" type="service">
<service_fmri value="svc:/system/filesystem/local"/>
</dependency>
<exec_method
type="method"
name="start"
exec="/opt/custom/script.sh"
timeout_seconds="60">
<method_context>
<method_credential user="root" group="staff"/>
<method_environment>
<envvar name="PATH" value="/opt/local/bin:/usr/bin:/usr/sbin:/bin"/>
</method_environment>
</method_context>
</exec_method>
<exec_method type="method" name="restart" exec=":kill" timeout_seconds="60">
<method_context>
<method_credential user="root" group="staff"/>
</method_context>
</exec_method>
<exec_method type="method" name="stop" exec=":kill" timeout_seconds="60">
<method_context>
<method_credential user="root" group="staff"/>
</method_context>
</exec_method>
<property_group name="startd" type="framework">
<propval name="ignore_error" type="astring" value="core,signal"/>
<propval name='duration' type='astring' value='transient' />
</property_group>
<stability value="Evolving"/>
<template>
<common_name>
<loctext xml:lang="C">run script at startup</loctext>
</common_name>
</template>
</service>
</service_bundle>
#!/bin/sh
# do stuff here
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment