- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: something special with hp-ux 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
Discussions
Discussions
Discussions
Forums
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
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
тАО09-14-2005 08:23 PM
тАО09-14-2005 08:23 PM
I have a little problem but I can't find the solution (I don't know hp-ux very well)
In my mind, when you want start a software on unix system startup you must write a script in /etc/init.d (/sbin/init.d/bbclient under hp-ux) and create a link in /etc/rc3.d (/sbin/rc3.d/ under hp-ux).
so I have this :
# uname -a
HP-UX HP-NSR B.11.00 U 9000/879 288035332 unlimited-user license
# ls -la /sbin/init.d/bbclient
-rwxr-xr-x 1 root sys 885 Sep 13 14:47 /sbin/init.d/bbclient
# ls -la /sbin/rc3.d/S999bbclient
lrwxrwxrwx 1 root sys 21 Dec 28 2004 /sbin/rc3.d/S999bbclient -> sbin/init.d/bbclient
# cat /sbin/init.d/bbclient
#!/bin/sh
#
# Copyright (c) 1991-1999 by Sun Microsystems, Inc.
# All rights reserved.
#
#ident "@(#)Arret demarrage du client bbuser 12/03/02 AvS"
id=`/bin/ps -edf | /bin/grep bbc |/bin/grep -v bbclient|/bin/grep -v grep| /bin/awk '{print $2}'`
case "$1" in
'start')
if [ -n "$id" ]; then
echo "big brother client is already started"
else
echo "starting big brother client"
(su - bbuser -c "/home/bbuser/bbc/runbb.sh $1&")>/dev/console 2>&1
fi
;;
'stop')
if [ -n "$id" ]; then
echo "Stopping big brother client"
(su - bbuser -c "/home/bbuser/bbc/runbb.sh $1&")>/dev/console 2>&1
else
echo "big brother client is not running"
fi
unset id
;;
*)
echo "Usage: $0 { start | stop }"
exit 1
;;
esac
When I do this, all is well, the softare run:
/sbin/init.d/bbclient start
but when I do a reboot, the software don't start.
It's a basic question but under solaris and linux there is no problem.
Is there something special for startup script under hp-ux ?
Thanks a lot for your help
Julien
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-14-2005 08:31 PM
тАО09-14-2005 08:31 PM
Re: something special with hp-ux startup script ?
check /etc/inittab or who -r
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-14-2005 08:33 PM
тАО09-14-2005 08:33 PM
Re: something special with hp-ux startup script ?
/sbin/rc3.d/S999bbclient -> /sbin/init.d/bbclient
Or was the missing leading "/" on bbclient a typo?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-14-2005 08:36 PM
тАО09-14-2005 08:36 PM
Re: something special with hp-ux startup script ?
Create startup & kill files /sbin/rc3.d .
Eg:
To start the any script when reboot,
ln -s /sbin/init.d/call_script /sbin/rc3.d/S900call.rc
To kill the any script when reboot,
ln -s /sbin/init.d/call_script /sbin/rc3.d/K900call.rc
Note:
Here original file is /sbin/init.d/call_script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-14-2005 08:37 PM
тАО09-14-2005 08:37 PM
Re: something special with hp-ux startup script ?
Try creating S899bbclient instead of S999bbclient.
You can also create a run-level 4 for your HP-UX server.
Check with "who -r" and change your default run-level after a reboot to 4.
Regards MB.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-14-2005 08:45 PM
тАО09-14-2005 08:45 PM
Re: something special with hp-ux startup script ?
# ls -la /sbin/rc3.d/S999bbclient
lrwxrwxrwx 1 root sys 21 Dec 28 2004 /sbin/rc3.d/S999bbclient -> sbin/init.d/bbclient
Do this,
# rm -rf /sbin/rc3.d/S999bbclient
# cd /sbin/rc3.d/
# ln -s /sbin/init.d/bbclient S999bbclient
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-14-2005 09:11 PM
тАО09-14-2005 09:11 PM
Re: something special with hp-ux startup script ?
when customizing rc scripts on startup I always use /sbin/init.d/template. I should suggest you to start from the template and re-create your startup script based on that. Also it needs a configuration file under /etc/rc.config.d and I see that it's missing in your startup script.
A lot of docs about how to configure it into ITRC forum:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=903953
HTH.
Best regards,
Fabio
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-14-2005 09:56 PM
тАО09-14-2005 09:56 PM
Re: something special with hp-ux startup script ?
to get feedback at startup/shutdown, you have to implement the arguments
start_msg
stop_msg
for your rc-script like
...
;;
start_smg) echo big brother client ;;
Leave this message output in your
start)-block.
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-15-2005 02:02 AM
тАО09-15-2005 02:02 AM
Solution# ll /sbin/init.d/bb
-rwxr-xr-x 1 bin bin 1578 Jun 4 2004 /sbin/init.d/bb
# cat /sbin/init.d/bb
#!/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 Big Brother
#
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 BB monitoring."
;;
stop_msg)
echo "Stoping BB monitoring "
;;
'start')
if [ -f /etc/rc.config.d/bb ] ; then
. /etc/rc.config.d/bb
else
echo "ERROR: /etc/rc.config.d/bb defaults file MISSING"
fi
if [ "$BB" -eq 1 ]; then
su - bb -c "nohup /app/admin/bb/runbb.sh start /dev/null 2>&1" && echo bb started
set_return
else
rval=2
fi
;;
'stop')
if [ -f /etc/rc.config.d/bb ] ; then
. /etc/rc.config.d/bb
else
echo "ERROR: /etc/rc.config.d/bb defaults file MISSING"
fi
if [ "$BB" -eq 1 ]; then
su - bb -c "/app/admin/bb/runbb.sh stop" && echo bb stopped
set_return
else
rval=2
fi
;;
*)
echo "usage: $0 {start|stop}"
;;
esac
exit $rval
# cat /etc/rc.config.d/bb
#!/sbin/sh
# @(#) $Revision: 1.0 $
# BIG BROTHER configuration.
#
# BB: Set to 1 to start bb monitoring.
#
BB=1
# ll /sbin/rc*/*bb*
lrwxr-xr-x 1 root sys 12 Jun 4 2004 /sbin/rc2.d/K005bb -> ../init.d/bb
lrwxr-xr-x 1 root sys 12 Jun 4 2004 /sbin/rc3.d/S995bb -> ../init.d/bb
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-15-2005 02:40 AM
тАО09-15-2005 02:40 AM
Re: something special with hp-ux startup script ?
There are actually two files to create: the start/stop script and the configure script. The configure script is stored in /etc/rc.config.d and usually named the same as the start/stop script. In it's simplest form, the configure script might just say:
BBRUN=1
and then in your start/stop script, you would test for BBRUN=1 to start the program (never test for BBRUN=1 for stopping it since it may be running and if you change BBRUN=0 for the next reboot, it won't be stopped during shutdown.
The line:
id=`/bin/ps -edf | /bin/grep bbc |/bin/grep -v bbclient|/bin/grep -v grep| /bin/awk '{print $2}'`
might be somewhat protable between flaors of Unix but it is an awful way to find a process by name. It will return programs like bbc1 and userbbc and bbbccc. HP-UX has a very powerful ps command that eliminates grep completely and simplifies getting the details you want by using -o. Replace the id line above with:
id=$(UNIX95= ps -C bbc -o pid=)
This will have either an empty string (id="") if not bbc process is found, or a list of all the copies of bbc (b ut not bbcclient, etc).
I have attached a heavily documented template file you can use to build a good start/stop script.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-15-2005 03:39 AM
тАО09-15-2005 03:39 AM
Re: something special with hp-ux startup script ?
I didn't know this sort of config file,
on linux and solaris there is only one file in /etc/init.d/
But now, I know :)
Thanks a lot for all yours answers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-15-2005 03:39 AM
тАО09-15-2005 03:39 AM