Create a basic Solaris runtime control script

Home -> UNIX -> Solaris -> System administration

15431 views

From the computer of: qmchenry (338 recipes)
Created: Oct 04, 2003     Updated: Jul 19, 2004


Add a comment

Add to:
Add to stumbleuponAdd to del.icio.usDigg itAdd to FURL

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
#
#  http://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

Subscribe to the Tech-Recipes Newsletter

You can get tips like this delivered in your email every week!

Enter your Email

We will never, ever sell your email address or spam you.





Related recipes:

  Understanding Solaris runtime control scripts
  Set the ethernet MAC address in Solaris
  Prevent Solaris core files creation with coreadm
  begin_script to mirror two drives on a Netra T2000
  Create a local Solaris flash archive
  How to make Solaris reject remote logging
  Configure Solaris for DNS resolution of hostnames
  Solaris 10: connect or login to zone console
  ZFS: Create a basic filesystem or pool using zpool
  Solaris: Create a mount point

 

Sponsored links

 

Login

Nickname

Password

Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.