Help with restarting of application with reboot of AIX server

Hi,

We have hosted our application on AIX server. The problem is that we have to start our application manually once the server is rebooted. Please guide me in writing a script that does this job automatically with the re-start of the server. I'm looking for something like windows services in unix.

Thanks in advance!
Himanshu

put your start/stop script under /etc/rc2.d

1 Like

Hi.

You have a couple of options, really.

Either use /etc/inittab, or for more control, put your start / stop script in /etc/init.d, and link your S and K scripts from /etc/rc2.d to the script.

Typically, a basic init.d script will look something like:

#!/bin/ksh

##################################################
# name: myScript.ksh
# purpose: Script to stop and start my application
##################################################

case "$1" in
start )
        :  commands used to start your application
        ;;
stop )
        :  commands used to stop your application
        ;;
* )
        echo "Usage: $0 (start | stop)"
        exit 1
esac

Then:

# ln -s /etc/init.d/myScript.ksh /etc/rc2.d/S99myScript
# ln -s /etc/init.d/myScript.ksh /etc/rc2.d/K01myScript

where S99 and K01 are the sequence during a startup / shutdown that your application will be started and stopped in relation to other S and K scripts in rc2.d.

1 Like