In this exercise you will create a new service.
It is a dummy services that only sleeps for a long
time and is started from a script. The script will
be the start-method that you supply in the service
manifest file.
1. Login to your solaris 11 vm and switch to the root user.
-bash-4.1$ su -
Password: e1car0
Oracle Corporation SunOS 5.11 11.0 November 2011
You have new mail.
root@solaris11-1:~#
2. Change directory to /var/svc/manifest/site
root@solaris11-1:/# cd /var/svc/manifest/site
root@solaris11-1:/var/svc/manifest/site#
3. Export the cron-service to mysvc.xml
root@solaris11-1:~# svccfg export cron > mysvc.xml
4. Make the following changes to mysvc.xml
old: service name='system/cron' type='service' version='0'
new: service name='site/mysvc' type='service' version='0'
old: dependency and dependent lines
new: (removed)
old: exec_method name='start' type='method' exec='/lib/svc/method/svc-cron' timeout_seconds='60'
new: exec_method name='start' type='method' exec='/lib/svc/method/mysvc' timeout_seconds='60'
5. Create a script called mysvc is /lib/svc/method and make it executable.
root@solaris11-1:~# echo "sleep 10000&" > /lib/svc/method/mysvc
root@solaris11-1:~# chmod +x /lib/svc/method/mysvc
6. Restart the manifest-import service.
root@solaris11-1:~# svcadm restart svc:/system/manifest-import
7. Check the status of your service
root@solaris11-1:~# svcs mysvc
STATE STIME FMRI
online 14:39:16 svc:/site/mysvc:default