Skip to content

Instantly share code, notes, and snippets.

@85degree
Last active August 29, 2015 14:10
Show Gist options
  • Save 85degree/c045c6c3db1df613476d to your computer and use it in GitHub Desktop.
Save 85degree/c045c6c3db1df613476d to your computer and use it in GitHub Desktop.
SmartOS SMF Manifest for OpenLDAP Server
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type="manifest" name="slapd">
<service name="slapd" 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="filesystem" grouping="require_all" restart_on="error" type="service">
<service_fmri value="svc:/system/filesystem/local"/>
</dependency>
<method_context>
<method_credential user="root" group="root"/>
</method_context>
<exec_method type="method" name="start" exec="/opt/local/sbin/slapd -f %{config_file}" timeout_seconds="60"/>
<exec_method type="method" name="stop" exec=":kill" timeout_seconds="60"/>
<property_group name="startd" type="framework">
<propval name="duration" type="astring" value="child"/>
<propval name="ignore_error" type="astring" value="core,signal"/>
</property_group>
<property_group name="application" type="application">
<propval name="config_file" type="astring" value="/opt/local/etc/openldap/slapd.conf"/>
</property_group>
<stability value="Evolving"/>
<template>
<common_name>
<loctext xml:lang="C">
OpenLDAP Server
</loctext>
</common_name>
</template>
</service>
</service_bundle>

Save slapd.xml above to your current directory

Then run:

svccfg validate slapd.xml

Then import:

svccfg import slapd.xml

Enable service:

svcadm enable slapd

Check the service:

svcs slapd

and

ps auxw | grep slapd
@gozoinks
Copy link

If openldap-server is installed from the Joyent pkgin repository, the slapd executable is in /opt/local/libexec/slapd … the start method should reflect that, no?

@pk1048
Copy link

pk1048 commented Mar 12, 2015

If you are running on a Joyent SmartOS instance (from the official repository), you need to remove the 'propval name="duration" type="astring" value="child"' (or just go in with svccfg and remove the property)
line from the above file (in addition to the path change noted above). Otherwise the smf_restarter will continuously try to restart the slapd process, which will fail as the first slapd process already has port 389 in use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment