Runtime control scripts start and stop services when the system changes run levels. Well constructed rc scripts handle at least start and stop as command line arguments.
Runtime control scripts are just regular shell scripts and anything that is valid for the shell that executes it is valid in the script. Note that it is advisable to use the statically linked /sbin/sh as the interpreter so that the script can run without the dynamic libraries. The command interpreter can be defined on the first line of the script by preceeding it with the #! characters. For more information, see Understanding Solaris runtime control scripts.
The following code is a runtime control script example for starting and stopping a SunONE web server located in /usr/iplanet/webserver/https-www.tech-recipes.com
#!/sbin/sh
#
# web server runtime control script
#
# https://www.tech-recipes.com
#
case "$1" in
'start')
/usr/iplanet/webserver/https-www.tech-recipes.com/start
;;
'stop')
/usr/iplanet/webserver/https-www.tech-recipes.com/stop
;;
'restart')
/usr/iplanet/webserver/https-www.tech-recipes.com/restart
;;
*)
echo "Usage: $0 { start | stop | restart }"
exit 1
;;
esac
exit 0