Operating System - HP-UX
1753505 Members
6588 Online
108794 Solutions
New Discussion юеВ

Re: startup script starts then disappears..

 
SOLVED
Go to solution
Tina Waitherwerch
Occasional Advisor

startup script starts then disappears..

I have used the init.d/template to start a program called netwatch. I can manually start the program and see it by doing a ps -ef. After a reboot, the program starts (I put a ps -ef at the end of the script to output to a file) But by the time I can logon, the program is nowhere to be found. Is there someplace to look for a process that have been terminated or aborted. It's not in rc.log. Sadly, my startup won't work on any of my HP's, but it does work on my Sun boxes!?! I can even run the startup script from cron, but I would prefer at boot time. Any suggestions? Tin
4 REPLIES 4
Stefan Farrelly
Honored Contributor
Solution

Re: startup script starts then disappears..

in your /sbin/init.d startup script on the line where you actually invoke your netwatch script try inserting nohup in front of it. This will create a nohup.out file which you can check later to see why it dies.

Otherwise you can switch on process auditing. See man 1m audevent. You can monitor processes for what calls they make and their exit status and then use audisp to display this info back once it dies to see what happened.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Helen French
Honored Contributor

Re: startup script starts then disappears..

Which run level did you use? What run level are your system working? If it's 3, then put your startup script in run level 3 (/sbin/rc3.d).
Life is a promise, fulfill it!
Colin Topliss
Esteemed Contributor

Re: startup script starts then disappears..

Try doing:

scriptname > /tmp/start.log 2>&1

That will capture any error output.

It will most likely be an environment problem (ie the path to an executable you are trying to call has not been defined). I usually include a PATH statement:

PATH=$PATH:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin

at the start of the init script.

You might also want to look at no-hupping the script if it is meant to run continually in the background:

nohup scriptname > /tmp/start.log 2>&1 &
Colin Topliss
Esteemed Contributor

Re: startup script starts then disappears..

Try doing:

scriptname > /tmp/start.log 2>&1

in your init file. That will capture any error output.

It will most likely be an environment problem (ie the path to an executable you are trying to call has not been defined). I usually include a PATH statement:

PATH=$PATH:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin

at the start of the init script.

You might also want to look at no-hupping the script if it is meant to run continually in the background:

nohup scriptname > /tmp/start.log 2>&1 &