Tuesday, June 12, 2012

Startup Script for IHS on RHEL

Today I'm going to show you how to setup IHS to run after boot/reboot on RHEL.


  • First you need to know what is your default runtime level. To determinate default level see your inittab file:
  • [root@ic ~]# less /etc/inittab
  • find line start with id:< some number >:initdefault:
  • In my case I have level 3 as default:
  • id:3:initdefault:
  • As root, create a new file ihs in  /etc/init.d/
  • [root@ic ~]# vim /etc/init.d/ihs 



#!/bin/bash
# SERVICENAME should match this filename
SERVICENAME=$(basename $0)
LOCKFILE="/var/lock/subsys/${SERVICENAME}"
APACHECTL=/opt/IBM/HTTPServer/bin/apachectl

# The next lines are for chkconfig on RedHat systems.
# chkconfig: 2345 98 02
# description: Starts and stops IHS 

case "$1" in
  start)
    touch $LOCKFILE 
    ;;

  stop)
    rm -f $LOCKFILE
    ;;

  *)
    echo "Usage: $0 {start|stop|status|restart}"
    exit 1
    ;;
esac

$APACHECTL "$@"

  • Save file and add executable mark to be able to run the script:
  • [root@ic ~]# chmod u+x /etc/init.d/ihs
  • Now add new service and set up if to run on level 3
  • [root@ic ~]# chkconfig --add ihs
  • [root@ic ~]# chkconfig --level 3 ihs on




No comments:

Post a Comment