#!/bin/sh # # This script is to be used to startup and shutdown the Informix Server # Optimized for HP/UX # # Installation instructions # # Copy this script to /sbin/init.d # Link it to a start and a stop file in each of the rc?.d directory # appropriate for the run level for which you wish the engine to be started, eg: # # $ ln -s /sbin/init.d/informix /sbin/rc3.d/S900informix # $ ln -s /sbin/init.d/informix /sbin/rc2.d/K020informix # #################################################################################### # # Note: You can set the Informix environment several ways. # You can hardcode it here - or else you can set it using a file. # If you hardcode it here, it would look something like this... # #export INFORMIXDIR=/opt/informix #export INFORMIXSERVER=myserver_shm #export ONCONFIG=onconfig.myserver # If you set it using a file, it might look like this... ENV_FILE=/usr/local/bin/set_informix_env.sh if [ -x $ENV_FILE ] then . $ENV_FILE else echo "Error: the file used to set the Informix environment does not exist!" echo "The filename is: $ENV_FILE" exit 1 fi #------------------------------------------------------------------------------------- if [ $# -lt 1 ] then echo "Usage: $0 {start|stop|start_msg|stop_msg}" else case "$1" in "start_msg") echo "Starting up the Informix Online Server..." ;; "stop_msg") echo "Shutting down the Informix Online Server..." ;; "start") if [ `$INFORMIXDIR/bin/onstat 2>&- | /usr/bin/grep -c "not initialized"` -ne 0 ] then # If you wanted to rotate the online.log at start-up time # this would be a good place to put it. # /home/informix/bin/rotate_informix_logs.sh echo "Starting up the Informix Online Engine... " $INFORMIXDIR/bin/oninit cnt=60 # Give informix 60 seconds to come online before giving up flag_online=false while [ $cnt -gt 0 ] do if [ `$INFORMIXDIR/bin/onstat 2>&- | /usr/bin/grep -c "not initialized"` -eq 0 ] then flag_online=true break fi cnt=`expr $cnt - 1` # Decrement cnt sleep 1 done if [ $flag_online = true ] then $INFORMIXDIR/bin/onstat - # If you wanted to start continuous logging to tape at start-up time # this would be a good place to put it. # /home/informix/bin/start_logging.sh & echo "Zero profile counts..." onstat -z echo "done" else echo "Warning: the Informix Online Engine did NOT start successfully!" fi fi ;; "stop") if [ `$INFORMIXDIR/bin/onstat 2>&- | /usr/bin/grep -c "not initialized"` -eq 0 ] then # If you wanted to stop continuous logging to tape at shutdown time # this would be a good place to put it. # /home/informix/bin/stop_logging.sh echo "Shutting down the Informix Online Engine... " $INFORMIXDIR/bin/onmode -ky cnt=60 # Give informix 60 seconds to come offline before giving up flag_online=true while [ $cnt -gt 0 ] do if [ `$INFORMIXDIR/bin/onstat 2>&- | /usr/bin/grep -c "not initialized"` -ne 0 ] then flag_online=false break fi cnt=`expr $cnt - 1` # Decrement cnt sleep 1 done if [ $flag_online = true ] then echo "Warning: the Informix Online Engine did NOT go offline successfully!" else echo "done" fi fi ;; *) echo "Usage: $0 {start|stop|start_msg|stop_msg}" ;; esac fi