You can use the svcbundle service bundle generator tool to create a simple service or to start a more complex service. For more information, see the svcbundle(1M) man page. You can use the service bundle DTD and other service manifests to complete a more complex service.
By default, svcbundle creates a transient service. Determine whether the start method script for this service starts any long-running daemon and therefore this service is a contract service. See Service Models in Managing System Services in Oracle Solaris 11.3, the model property in the svcbundle(1M) man page, and the startd/duration property in the svc.startd(1M) man page for information about service models.
The service in this example uses a custom script named ex_svc as the start method. Copy this script to /lib/svc/method/ex_svc.
In this example, the service name is site/ex_svc. This service is a transient service and does not need a stop method.
$ svcbundle -o /tmp/ex_svc.xml -s service-name=site/ex_svc \ -s start-method=/lib/svc/method/ex_svc
If this service were a contract service, you would specify contract or daemon as the value of the model or duration property, as in -s model=contract.
Verify that the content of the /tmp/ex_svc.xml manifest is what you need. You might need to add a dependency or adjust the method timeout, for example. Add comments to describe what the service does and how the properties of the service are used.
Use the svccfg validate command to ensure the service manifest is valid.
$ svccfg validate /tmp/ex_svc.xml
$ cp /tmp/ex_svc.xml /lib/svc/manifest/site/ex_svc.xml
$ svcadm restart manifest-import
Verify that the new service exists and is in the expected state.
$ svcs ex-svc
If you do not need to make any changes to the new service manifest, you can use the -i option to install the manifest as soon as it is created. The svcbundle command will write the manifest to /lib/svc/manifest/site and restart the manifest-import service. Any existing file with the same name in the /lib/svc/manifest/site directory will be overwritten.
$ svcbundle -i -s service-name=site/ex_svc \ -s start-method=/lib/svc/method/ex_svc