Operating System - HP-UX
1844003 Members
2497 Online
110226 Solutions
New Discussion

init script problem during bootup

 
someman
Occasional Contributor

init script problem during bootup

HP-UX 11.11

I created init script to start ssh daemon from a template in /sbin/init.d and created /etc/config.d/ file with configuration and added proper links to start it in runlevel 3,which is default for my system.

When I run script by hand from console,ie: /sbin/init.d/sshd start it starts ok.When i do init 2 and then init 3 script also runs ok. But during boot it doesn`t start daemon,although script is executed.I inserted commands like echo "running script..." > /tmp/log and echo "script ran..." >> /tmp/log. It seems like sshd dies...

I searched this forum and found simular problems.I will try with nohup option and some other tips.(but: sshd when started from console goes into backgorund automatically...)

Also,i tried to create 2nd script,which runs oracle with help off dbstart script.Same effect,so it doesn`t look like sshd problem.

Can anyone describe this situation cleanly? I want to understand what is the difference between boot process,when switching to 3rd runlevel and manual command init 3 when in runlevel 2 ? Why daemon can`t start?
3 REPLIES 3
Mel Burslan
Honored Contributor

Re: init script problem during bootup

I have a question :

while the system is starting up, executing rcX.d/Sxxx scripts where you see the pass/fail status screens, do you see your init script being processed ? If yes, is it exiting with "OK" status ?

If the answer to all of the above is YES, then if I were you I would put some sort of a checking mechanism at the end of my init script like

...
/opt/ssh/sbin/sshd
sleep 5
ps -ef | grep sshd | grep -v grep >/tmp/dump
result=`echo $?`
if [ $result -ne 0 ]
then
# either set EXITSTATUS to nonzero for this script and finish execution
# or retry starting it again
# upto you
fi
...

exit $EXITSTATUS

________________________________
UNIX because I majored in cryptology...
Tom Ward_1
Honored Contributor

Re: init script problem during bootup

Hello,

For ssh I suggest you consider running HP's version of it. It is avalable from a link at
http://www.hp.com/products1/unix/operating/security/index.html#network
Be sure to get the Strong Random Number Generator also from a link on that page.
Here's the direct link for ssh
http://www.software.hp.com/cgi-bin/swdepot_parser.cgi/cgi/displayProductInfo.pl?productNumber=T1471AA
The HP depot for ssh will install init scripts.

I realize this won't answer your question regarding init scirpts, but it will address your ssh problem. You may get some ideas from looking at the scripts that HP provides.

Regards,
Tom
Bill Hassell
Honored Contributor

Re: init script problem during bootup

The first p-lace to start is /etc/rc.log which is the log for all startup scripts. Even if you miss any error messages during bootup, they will be found in rc.log. nohup isn't necessary since sshd is a correctly written daemon (it moves itself out of the current session and assigns itself to init). The easiest way to see if sshd is actually started is to add this to the beginning of the script:

set -x

All the debug details will be in /etc/rc.log (and the shutdown steps are appended to rc.log and written to rc.log.old)


Bill Hassell, sysadmin