Operating System - HP-UX
1751977 Members
4430 Online
108784 Solutions
New Discussion юеВ

Re: Need informix /sbin/init.d/informix startup/shutdown script

 
SOLVED
Go to solution
Jack C. Mahaffey
Super Advisor

Need informix /sbin/init.d/informix startup/shutdown script

Anybody got an /sbin/init.d/informix startup/shutdown script for 11.0 to share? We're running informix 7.31 and the previous admin never created any rc scripts for startup/shutdown.

The current ~informix/.profile script includes prompts for whoever is logging onto the informix user account so doing a su - informix will not work. I want to leave the current ~informix/.profile alone.

I want to be sure that root can start the instance AND properly set the environment variables needed for starting/stopping the database. I figure I'll need to do 'su informix ...' commands but know they will fail if I do not have the correct environment variables and PATH's set prior to executing the commands.

Thanks in advance... Jack...
5 REPLIES 5
Mel Burslan
Honored Contributor

Re: Need informix /sbin/init.d/informix startup/shutdown script

As we are an oracle-only shop, I do not have copy of my own but googling informix resources on the web turned this puppy. Hope it helps

http://www.prstech.com/src/S900informix_hp.sh.txt

(linked from this page here : http://www.prstech.com/downloads.shtml)
________________________________
UNIX because I majored in cryptology...
D Block 2
Respected Contributor
Solution

Re: Need informix /sbin/init.d/informix startup/shutdown script

Jack, see the attached scripts.

1. S995dbstart - /sbin/rc3.d

2. rcconfigscript - /etc/rc.config.d/dbstart

Golf is a Good Walk Spoiled, Mark Twain.
D Block 2
Respected Contributor

Re: Need informix /sbin/init.d/informix startup/shutdown script

Jack, I'll try again here, by inserting the shells:

shell 1:
#file /etc/rc.config.d/dbstartdb ------------------------------------

export INFORMIXDIR=/informix
export INFORMIXSERVER=FOOBARk
export ONCONFIG=onconfig.FOOBAR
export IFMX_HPKAIO_NUM_REQ=5000
export KAIOON=1

# end file /etc/rc.config.d/dbstartdb


shell 2:
# file /sbin/rc3.d/S995dbstart -----------------------------------------

#!/bin/sh
set -x
#
# 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, e
g:
#
# $ ln -s /sbin/init.d/informix /sbin/rc3.d/S900informix
# $ ln -s /sbin/init.d/informix /sbin/rc0.d/K500informix
#
################################################################################
####
#
# 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=/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

ENV_FILE=/etc/rc.config.d/dbstartdb
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"` -n
e 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=30 # Give informix 30 seconds to come online before giv
ing up
flag_online=false
while [ $cnt -gt 0 ]
do
if [ `$INFORMIXDIR/bin/onstat 2>&- | /usr/bin/grep -c "not initiali
zed"` -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 tim
e
# this would be a good place to put it.
# /home/informix/bin/start_logging.sh &
echo "done"
else
echo "Warning: the Informix Online Engine did NOT start successfull
y!"
fi
fi
;;

"stop")
if [ `$INFORMIXDIR/bin/onstat 2>&- | /usr/bin/grep -c "not initialized"` -e
q 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=30 # Give informix 30 seconds to come offline before gi
ving up
flag_online=true
while [ $cnt -gt 0 ]
do
if [ `$INFORMIXDIR/bin/onstat 2>&- | /usr/bin/grep -c "not initiali
zed"` -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 succes
sfully!"
else
echo "done"
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 succes
sfully!"
else
echo "done"
fi
fi
;;
*)
echo "Usage: $0 {start|stop|start_msg|stop_msg}"
;;
esac
fi

Golf is a Good Walk Spoiled, Mark Twain.
Ralph Grothe
Honored Contributor

Re: Need informix /sbin/init.d/informix startup/shutdown script

Hi,

I'm no Informix admin,
but we have many Informix clusters running.
When I look at our init scripts I have to conclude that starting and stopping an Informix instance is astonishingly simple.
So you can easily create your own script from a copy of /sbin/init.d/template

All it requires is the setting of three environment variables, and issuing one on* command.

In your script export the following:

INFORMIXDIR
this must point to the root dir of your informix instance.

INFORMIXSERVER
this holds the name of your informix instance

ONINIT=onconfig # most of the times
this is the name of your instance's config file

With these set in the environment of the starting process simply run

$INFORMIXDIR/bin/oninit -v
to start your instance

$INFORMIXDIR/bin/onmode -ky
to shut down your instance


Whenever I needed to get my hands dirty with some (surface scratching) DBMS stuff I always admired the elegance and closeness to the UNIX philosophy of Informix.
You can run the most aggregated and involved query or admin tasks from the Unix shell like you are used to from Unix system administration.
I've never seen such with our Oracle DBMSs.

Madness, thy name is system administration
Jack C. Mahaffey
Super Advisor

Re: Need informix /sbin/init.d/informix startup/shutdown script

Thanks all.... Very useful info. The best place on the web for HP help. :)


jack...