In order to create init scripts on our Sun servers you need to go through the following steps:
1. Create a basic init-script in /etc/opt/csw/init.d – They have the same syntax as standard unix init/shell scripts and should contain at least a start and a stop case. Make sure the permissions are 755 root:bin
2. If they don't exist already, create the following directories: /var/opt/csw/svc/manifest/network and /var/opt/csw/svc/method … they should have the same permissions as your init script. (note: you don't have to use "network" if it is not a networking service you are trying to create)
3. Create a XML-manifest file in /var/opt/csw/svc/manifest/network. You can find many example files in your solaris system are via google. They are pretty straight forwarded. Edit the file in a way that it fits your configuration and make sure the exec path of your methods link to /var/opt/csw/svc/method/$foo (with $foo being a symlink to your init-script in /etc/opt/csw/init.d)
4. Use 'svccfg import bar.xml' (bar being the name of your manifest file) to register your service with the system.
5. Use 'svcadm enable bar' (see above) to enable the service.
If you run into problems and you feel like your service won't start you can check on its status via 'svcs -xv'
- 09 Mar 2012
| Title || Create Init Scripts for Solaris |
| Description || Short tutorial how to properly set up init scripts on Solaris |
| Tags || init sun solaris daemon autostart |
| Category || Admin |