Operating System - HP-UX
1824976 Members
3706 Online
109678 Solutions
New Discussion юеВ

Script will not start processes from /sbin/init.d

 
scifusers
Advisor

Script will not start processes from /sbin/init.d

HP-UX swprodso B.11.11 U 9000/800/rp7420

##################################
Hello anyone who cares to help. I have a script that will execute just fine from command line ( start processes ), but will
not start processes from /sbin/init.d when system reboots ?

##################################

# ll /sbin/rc3.d/S999mqmjava
lrwx------ 1 root sys 27 Feb 9 16:56 /sbin/rc3.d/S999mqmjava -> /sbin/init.d/mqm_abrrc_java

###########
Attempt to start in rc.log :
#
Starting mqm , java applications
Output from "/sbin/rc3.d/S999mqmjava start":
----------------------------
java did not start successfully. exiting...
"/sbin/rc3.d/S999mqmjava start" SKIPPED


###########
Produced outputted log files :
Failed after system reboot :
-rw-r--r-- 1 root root 37656 Feb 10 04:25 mqm_one_script.log.021007.0425
No processes started :



Successfull after command line execution :
-rw-r--r-- 1 root root 37859 Feb 10 10:34 mqm_one_script.log.021007.1034

starts the following processes :
root@swprodso[/sbin/init.d]
# ps -aef | grep -i mqm
mqm 20209 1 0 07:21:31 ? 0:11 /opt/java1.4/bin/PA_RISC2.0/rmiregistry
mqm 20213 1 0 07:21:31 ? 0:25 /opt/java1.4/bin/PA_RISC2.0/java -DInst=EPEUAT -classpath /home


######################################
Difference between
successful-command line :
mqm_one_script.log.021007.1034


failed-rc3.d startup
mqm_one_script.log.021007.0425


root@swprodso[/tmp]
# diff mqm_one_script.log.021007.0425 mqm_one_script.log.021007.1034 > /tmp/diff.mqm.out ; cat /tmp/diff.mqm.out
1d0
< stty: : Not a typewriter
31,33c30
< stty: : Not a typewriter
< stty: : Not a typewriter
#!/sbin/sh -vx
---
#!/sbin/sh -vx
160d156
< + /opt/java1.4/bin/rmiregistry
163a160
> + /opt/java1.4/bin/rmiregistry
192d188
< + 1>> /var/mqm/epe.out
193a190
> + 1>> /var/mqm/epe.out


3 REPLIES 3
James R. Ferguson
Acclaimed Contributor

Re: Script will not start processes from /sbin/init.d

Hi:

Your '/etc/rc.log' shows:

"/sbin/rc3.d/S999mqmjava start" SKIPPED

This indicates that your script exited with a return value of two (2). This would occur if, in turn, the controlling variable the configuration file for 'mqmjava' in the '/etc/rc.config.d/' directory is set to zero (0).

Regards!

...JRF...
melvyn burnard
Honored Contributor

Re: Script will not start processes from /sbin/init.d

Also, make sure your script has all the required PATH settings inside it.
When running this from root it seems it can find correct paths, but they may not be set in the environment when run from system boot up
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!
Bill Hassell
Honored Contributor

Re: Script will not start processes from /sbin/init.d

> stty: : Not a typewriter

While this is not the cause of the startup error, it indicates that you are likely using su and the user's profile has not been adjusted for batch mode processing. Every terminal dependent command must be protected in profiles that may be used in batch mode (ie, scripts like start/stop, cron, etc). Take a look at /etc/profile and the MQM user's .profile and protect the commands:

stty
ttytype
tabs
tset
tput

something like this:

if tty -s
then
eval $(ttytype -s)
stty ...
tabs ...
tput
fi

The other step is to trace the startup script during execution. Add set -x at the top of the script and a set +x at the end of the script to turn off tracing. That will show what happens when the system boots up (in /etc/rc.log).


Bill Hassell, sysadmin