Operating System - HP-UX
1831547 Members
3810 Online
110025 Solutions
New Discussion

Re: adding a script to run @ runtime

 
SOLVED
Go to solution
Paul Senior
Occasional Advisor

adding a script to run @ runtime

I want to add a script to run at runtime, AND run it with certain command line options.

I have placed the script in /sbin/init.d;
a 'start' link to the script in /sbin/rc2.d' and a 'kill' link to the script in /sbin/rc1.d

What is the best way of getting the script to run with certain command line options, e.g. nohup, & ,etc?

I cannot edit the script in /sbin/init.d as it is a compiled dynamically linked executable, so I cannot edit it to refer to a config script in /etc/rc.config.d

Cheers,
4 REPLIES 4
Brian Bergstrand
Honored Contributor
Solution

Re: adding a script to run @ runtime

Put a wrapper shell script in /sbin/init.d that reads config params from /etc/rc.config.d and then calls your binary. Make sure you use HP's template script as a starting point (in /sbin/init.d).

HTH.
John Poff
Honored Contributor

Re: adding a script to run @ runtime

Hi,

I would put your executable in another directory somewhere, and use a script in /sbin/init.d that calls your executable with whatever options you need. That is how all the other programs get started from /sbin/init.d.

JP
Patrick Wallek
Honored Contributor

Re: adding a script to run @ runtime

It is quite unusual to have a linked executable as a start / stop "script". The usual method of doing this is to have a shell script in /sbin/init.d that will call your program with whatever options you need.

There is good documentation on this online and there is a template start/stop script in /sbin/init.d called "template".

Paul Senior
Occasional Advisor

Re: adding a script to run @ runtime

Thanks, I didn't know about the 'template'
script in /sbin/init.d
Your replies cover what I wanted.