- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Adding program to startup script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2006 05:41 AM
07-19-2006 05:41 AM
Here is the info on the current server:
/sbin/rc3.d/
lrwxr-xr-x 1 root sys 38 Oct 17 2004 S200.informix.rc -> /apps/informix/fnsbscripts/informix.rc
-rwxr-xr-x 1 root sys 3041 Jun 4 2003 S210.ifas.rc
/sbin/rc2.d/
lrwxr-xr-x 1 root sys 38 Oct 17 2004 K200.infxshdwn -> /apps/informix/fnsbscripts/informix.rc
Here is the commands that I think should be done to add them to the startup/shutdown scripts.
ln –s /apps/informix/fnsbscripts/informix.rc /sbin/rc3.d/S200.informix.rc
ln –s /apps/informix/fnsbscripts/informix.rc /sbin/rc2.d/K200.informix.rc
The only one that I am un sure of doing is the startup of the ifas.rc. How would I add that to the rc3.d?
Thanks for the help.
Jeff
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2006 06:17 AM
07-19-2006 06:17 AM
Re: Adding program to startup script
to help i would like to see:
ll rwxr-xr-x 1 root sys 3041 Jun 4 2003 S210.ifas.rc
Need to know if the soft link is valid.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2006 06:17 AM
07-19-2006 06:17 AM
SolutionThen in thos scripts, call /apps/informix/fnsbscripts/informix.rc
etc...
Example
/sbin/init.d/informix
#!/usr/bin/sh
#
# @(#) $Revision: 1.0 $
#
# NOTE: This script is not configurable! Any changes made to this
# scipt will be overwritten when you upgrade to the next
# release of HP-UX.
#
#
# Start Informix
#
PATH=/sbin:/usr/sbin:/usr/bin
export PATH
rval=0
set_return() {
x=$?
if [ $x -ne 0 ]; then
echo "ERROR CODE $x"
rval=1
fi
}
case $1 in
start_msg)
echo "Starting Informix."
;;
stop_msg)
echo "Stoping Informix."
;;
'start')
if [ -f /etc/rc.config.d/informix ] ; then
. /etc/rc.config.d/informix
else
echo "ERROR: /etc/rc.config.d/informix defaults file MISSING"
fi
if [ "$INFORMIX" -eq 1 ]; then
/apps/informix/fnsbscripts/informix.rc start /dev/null 2>&1" && echo informix started
set_return
else
rval=2
fi
;;
'stop')
if [ -f /etc/rc.config.d/informix ] ; then
. /etc/rc.config.d/informix
else
echo "ERROR: /etc/rc.config.d/informix defaults file MISSING"
fi
if [ "$INFORMIX" -eq 1 ]; then
/apps/informix/fnsbscripts/informix.rc stop && echo Informix stopped
set_return
else
rval=2
fi
;;
*)
echo "usage: $0 {start|stop}"
;;
esac
exit $rval
# cat /etc/rc.config.d/informix
#!/sbin/sh
# @(#) $Revision: 1.0 $
# Informixconfiguration.
#
# INFORMIX: Set to 1 to startInformix
#
INFORMIX=1
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2006 06:25 AM
07-19-2006 06:25 AM
Re: Adding program to startup script
Is this what you are asking for?
root: /sbin/rc3.d ==> ll
total 12
lrwxr-xr-x 1 root sys 23 Oct 17 2004 S100nfs.server -> /sbin/init.d/nfs.server
lrwxr-xr-x 1 root sys 38 Oct 17 2004 S200.informix.rc -> /apps/informix/fnsbscripts/informix.rc
lrwxr-xr-x 1 root sys 19 Oct 17 2004 S200tps.rc -> /sbin/init.d/tps.rc
-rwxr-xr-x 1 root sys 3041 Jun 4 2003 S210.ifas.rc
-rwxr-xr-- 1 root sys 2609 Feb 4 2002 S300.Openlink.rc
lrwxr-xr-x 1 root sys 30 Oct 17 2004 S600netwatch -> /etc/best/netwatch/netwatch.rc
lrwxr-xr-x 1 root sys 23 Oct 17 2004 S990dtlogin.rc -> /sbin/init.d/dtlogin.rc
root: /sbin/rc3.d ==> more S210.ifas.rc
#!/sbin/sh
#
# @(#) $Revision: 78.1 $
#
# NOTE: This script is not configurable! Any changes made to this
# script will be overwritten when you upgrade to the next
# release of HP-UX.
#
# WARNING: Changing this script in any way may lead to a system that
# is unbootable. Do not modify this script.
#
# Purpose: Start up IFAS deamons
#
# Allowed exit values:
# 0 = success; causes "OK" to show up in checklist.
# 1 = failure; causes "FAIL" to show up in checklist.
# 2 = skip; causes "N/A" to show up in the checklist.
# Use this value if execution of this script is overridden
# by the use of a control variable, or if this script is not
# appropriate to execute for some other reason.
# 3 = reboot; causes the system to be rebooted after execution.
# Input and output:
# stdin is redirected from /dev/null
#
# stdout and stderr are redirected to the /etc/rc.log file
# during checklist mode, or to the console in raw mode.
PATH=/usr/sbin:/usr/bin:/sbin
export PATH
# NOTE: If your script executes in run state 0 or state 1, then /usr might
# not be available. Do not attempt to access commands or files in
# /usr unless your script executes in run state 2 or greater. Other
# file systems typically not mounted until run state 2 include /var
# and /opt.
rval=0
# Check the exit value of a command run by this script. If non-zero, the
# exit code is echoed to the log file and the return value of this script
# is set to indicate failure.
set_return() {
x=$?
if [ $x -ne 0 ]; then
echo "EXIT CODE: $x"
rval=1 # script FAILed
fi
}
# Kill the named process(es).
# $1=
killproc() {
pid=`ps -el | awk '( ($NF ~ /'"$1"'/) && ($4 != mypid) && ($5 != mypid)
){ print $4 }' mypid=$$ `
if [ "X$pid" != "X" ]; then
if kill "$pid"; then
echo "$1 stopped"
else
rval=1
echo "Unable to stop $1"
fi
fi
}
case $1 in
'start_msg')
# Emit a _short_ message relating to running this script with
# the "start" argument; this message appears as part of the checklist.
echo "Starting the IFAS daemons"
;;
'stop_msg')
# Emit a _short_ message relating to running this script with
# the "stop" argument; this message appears as part of the checklist.
echo "Stopping the IFAS daemons"
;;
'start')
# source the system configuration variables
if [ -f /etc/rc.config ] ; then
. /etc/rc.config
else
echo "ERROR: /etc/rc.config defaults file MISSING"
fi
# Execute the commands to start your subsystem
su - bsi -c ifasrc
su - testbsi -c ifasrc
su - devbsi -c ifasrc
/usr/openlink/bin/oplrqb -v
;;
'stop')
# source the system configuration variables
if [ -f /etc/rc.config ] ; then
. /etc/rc.config
else
echo "ERROR: /etc/rc.config defaults file MISSING"
fi
# Check to see if this script is allowed to run...
if [ "$CONTROL_VARIABLE" != 1 ]; then
rval=2
else
:
# Execute the commands to stop your subsystem
fi
;;
*)
echo "usage: $0 {start|stop|start_msg|stop_msg}"
rval=1
;;
esac
exit $rval
root: /sbin/rc3.d ==>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2006 06:34 AM
07-19-2006 06:34 AM
Re: Adding program to startup script
Jeffrey,
there is a template in /sbin/init.d you can use to design the start/stop of informix
You place the startup and shutdown commands in one script, and the correct portion gets called depending on whether the system is starting or stopping
you can then use the same script to stop/start the app manually
i.e. /sbin/init.d/informix stop
/sbin/init.d/informix start
You link the /sbin/rcX.d files to the script in /sbin/init.d
If you really want to be correct, you place a flag file in /etc/rc.config.d that is used by the main script to determine if you want to even run it.
HTH
Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2006 06:38 AM
07-19-2006 06:38 AM
Re: Adding program to startup script
edit /sbin/init.d/informix and add your startup script to the start secion and shutdown script to stop section. Change CONTROL_VARIABLE to whatever you like, i.e. INFORMIX
create /etc/rc.config.d/informix and set INFORMIX=1
chmod 775 /sbin/init.d/informix
ln -s /sbin/init.d/informix /sbin/rc3.d/S900informix
ln -s /sbin/init.d/informix /sbin/rc2.d/K900informix
Test.
/sbin/init.d/informix start
/sbin/init.d/informix stop
locating all startup controls in /sbin/init.d/ helps to keep things organized. ( you only have to look in /sbin/init.d/ to see what could be used at boot time.
Don't forget to set env and extra path statements in the scripts. Boot time runs with basic env.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2006 06:40 AM
07-19-2006 06:40 AM
Re: Adding program to startup script
This is worth a quick read for a complete understanding of the startup paradigm:
http://docs.hp.com/en/934/startup.pdf
The manpages for rc(1M) also provide a brief(er) overview.
Yes, althoght the whitepaper is titled for 10x it *is* approriate for all releases since then, too.
Your start and kill script sequence numbers should differ by 1000 to keep your script in the proper relationship to others both as you startup and shutdown. Hence, for S200 at runlevel N you should use K800 at runlevel N-1.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2006 07:30 AM
07-19-2006 07:30 AM
Re: Adding program to startup script
root: /sbin/init.d ==> more informix
#!/sbin/sh
#
# @(#)B11.23_LR
#
# NOTE: This script is not configurable! Any changes made to this
# script will be overwritten when you upgrade to the next
# release of HP-UX.
#
# WARNING: Changing this script in any way may lead to a system that
# is unbootable. Do not modify this script.
#
# Start Informix
#
PATH=/usr/sbin:/usr/bin:/sbin
export PATH
rval=0
set_return() {
x=$?
if [ $x -ne 0 ]; then
echo "EXIT CODE: $x"
rval=1 # script FAILed
fi
}
case $1 in
'start_msg')
echo "Starting Informix."
;;
'stop_msg')
echo "Stopping Informix."
;;
'start')
if [ -f /etc/rc.config.d/informix ] ; then
. /etc/rc.config.d/informix
else
echo "ERROR: /etc/rc.config.d/informix defaults file MISSING"
fi
if [ "$INFORMIX" != 1 ]; then
/apps/informix/fnsbscripts/informix.rc start /dev/null
2>&1" && echo Informix started
set_return
else
rval=2
fi
;;
'stop')
if [ -f /etc/rc.config.d/informix ] ; then
. /etc/rc.config.d/informix
else
echo "ERROR: /etc/rc.config.d/informix defaults file MISSING"
fi
if [ "$INFORMIX" != 1 ]; then
/apps/informix/fnsbscripts/informix.rc stop && echo informix stopped
set_return
else
rval=2
fi
;;
*)
echo "usage: $0 {start|stop}"
rval=1
;;
esac
exit $rval
root: /sbin/init.d ==>
root: /etc/rc.config.d ==> more informix
#!/sbin/sh
#
# Revision: 1.0
#
# Informix configuration.
#
# INFORMIX: Set to 1 to start informix
#
INFORMIX=1
root: /etc/rc.config.d ==>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2006 07:35 AM
07-19-2006 07:35 AM
Re: Adding program to startup script
Well, you have this negated:
if [ "$INFORMIX" != 1 ]; then
...You want to start or stop your database when equal one, as:
if [ "${INFORMIX}" -eq 1 ]; then
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2006 06:40 AM
07-20-2006 06:40 AM
Re: Adding program to startup script
root: /sbin/init.d ==> /sbin/init.d/informix stop
/sbin/init.d/informix[28]: Syntax error at line 68 : `"' is not matched.
root: /sbin/init.d ==>
I took a look at the /sbin/init.d/informix file at line 68 but don't see a problem.
echo "usage: $0 {start|stop|start_msg|stop_msg}"
What could be causing this problem?
THanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2006 06:43 AM
07-20-2006 06:43 AM
Re: Adding program to startup script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2006 06:48 AM
07-20-2006 06:48 AM
Re: Adding program to startup script
Actually, the problem exists ~line 46:
2>&1" && echo Informix started
...should read:
2>&1 && echo Informix started
...that is, without the double-quote character.
*ALSO*: Please re-read my last post. Your testing of 'if [ "$INFORMIX" != 1 ]; then' is backwards from convention.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2006 07:41 AM
07-20-2006 07:41 AM
Re: Adding program to startup script
I've attached an older HP doc that addresses startup programs. We're on 11.0, but still find the doc relevent.
Best of luck on this.
-dl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2006 11:11 AM
07-20-2006 11:11 AM