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

User Tools

Site Tools



Recently Changed Pages:

View All Pages

View All Tags

WIKI Disclaimer: As with most other things on the Internet, the content on this wiki is not supported. It was contributed by me and is published “as is”. It has worked for me, and might work for you.
Also note that any view or statement expressed anywhere on this site are strictly mine and not the opinions or views of my employer.

Pages with comments

2019/11/18 13:52 1 Comment

View All Comments


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:

  1. 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.
  2. 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).
  3. 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:

# Created by Sjoerd Hooft
# Added on 5 November 2010
### Script Variables
export JAVA_HOME=/usr/java5_64
case "$1" in
start )
   echo "Starting the ${APPNAME} Application"
   su $RUN_USER -c ${APPDIR}/
stop )
   echo "stopping the ${APPNAME} Application"
   su $RUN_USER -c ${APPDIR}/
* )
   echo "Usage: $0 COMMAND"
   echo "---------------------------"
   echo "start    - Start ${APPNAME} instance in ${APPDIR}"
   echo "stop     - Stop ${APPNAME} instance in ${APPDIR}"
   exit 1

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):

sjoerd@db:/etc/rc.d/rc2.d>sudo ln -s /etc/ S10oracle
sjoerd@db:/etc/rc.d/rc2.d>sudo ln -s /etc/ K90oracle

Extra Resources

What does RC mean:

Runtime Commands:
From the original Jargon File:

: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).


Enter your comment. Wiki syntax is allowed:
aixrcscripts.txt · Last modified: 2019/11/18 12:21 (external edit)