SHIFT

--- Sjoerd Hooft's InFormation Technology ---

User Tools

Site Tools


aixrcscripts
Differences

This shows you the differences between two versions of the page.

Link to this comparison view

aixrcscripts [2013/02/25 20:19] (current)
sjoerd created
Line 1: Line 1:
 += AIX RC.Scripts =
  
 +Although I thought RC scripts were pretty simple I ran into some scripts yesterday that were so not rc.scripts, but configured for them anyway. The point was, they didn't had an start/stop parameter defined... ​
 +
 +So, how do rc.scripts work:
 +# Write a single script, put it into /​etc/​rc.d/​init.d,​ make sure the script accepts a single parameter of start or stop and does the right thing.
 +# In /​etc/​rc.d/​rc2.d create a link (ln -s) to the script in init.d called Sxxname where xx is a number that dictates where in comparison to other scripts in the directory your script will execute (lower number first).
 +# In /​etc/​rc.d/​rc2.d create a link to the script in init.d called Kxxname where xx is a number which dictates when the script is run to stop your app in comparison to other scripts in the directory (lower number first).
 +
 += Example Script =
 +This is an example script on how a rc.script might look:
 +<code bash>
 +#!/bin/ksh
 +# Created by Sjoerd Hooft
 +# Added on 5 November 2010
 +
 +### Script Variables
 +APPDIR=/​opt/​sft/​product/​bin
 +APPNAME=product
 +RUN_USER=appuser
 +
 +export JAVA_HOME=/​usr/​java5_64
 +
 +case "​$1"​ in
 +
 +start )
 +   echo "​Starting the ${APPNAME} Application"​
 +   su $RUN_USER -c ${APPDIR}/​startup.sh
 +;;
 +
 +stop )
 +   echo "​stopping the ${APPNAME} Application"​
 +   su $RUN_USER -c ${APPDIR}/​shutdown.sh
 +;;
 +
 +* )
 +   echo "​Usage:​ $0 COMMAND"​
 +   echo "​---------------------------"​
 +   echo "​start ​   - Start ${APPNAME} instance in ${APPDIR}"​
 +   echo "​stop ​    - Stop ${APPNAME} instance in ${APPDIR}"​
 +   echo
 +   exit 1
 +
 +esac
 +</​code>​
 +
 += Example Creating Symbolic Links =
 +This is an example on creating symbolic links for automatic startup for oracle. Oracle should start first (meaning a low Sxx) and stop last (meaning a high Kxx):
 +<​code>​
 +sjoerd@db:/​etc/​rc.d/​rc2.d>​sudo ln -s /​etc/​rc.oracle S10oracle
 +sjoerd@db:/​etc/​rc.d/​rc2.d>​sudo ln -s /​etc/​rc.oracle K90oracle
 +</​code>​
 +
 += Extra Resources =
 +What does RC mean:
 +
 +**Runtime Commands**: \\
 +From the original Jargon File: http://​www.catb.org/​jargon/​oldversions/​jarg310.txt:​
 +
 +> :rc file: /R-C fi:l/ n.  [UNIX: from `runcom files' on the {CTSS} system ca.1955, via the startup script= `/​etc/​rc'​] Script file containing startup instructions for an application program (or an entire operating system), usually a text file containing commands of the sort that might have been invoked manually once the system was running but are to be executed automatically each time the system starts up.  See also {dotfile}, {profile} (sense 1).
 +
 +{{tag>​aix scripts}}
aixrcscripts.txt ยท Last modified: 2013/02/25 20:19 by sjoerd