Operating System - HP-UX
1748006 Members
4493 Online
108757 Solutions
New Discussion юеВ

Command execution at system startup

 
SOLVED
Go to solution
Din_1
Frequent Advisor

Command execution at system startup

Hi All,

I need to execute a command which starts a license deamon,as another user on startup of my HP UX system. How can i acheive this?

#uname -a
HP-UX unix1 B.11.11 U 9000/800 3654209165 unlimited-user license

Thanks in Advance,
Din
6 REPLIES 6
James R. Ferguson
Acclaimed Contributor

Re: Command execution at system startup

Hi Din:

You can setup a statup 'rc' script. The manpages for 'rc(1M') and/or this (still) applicable whitepaper provide all the details you need:

http://docs.hp.com/en/934/startup.pdf

You can copy the '/sbin/init.d/template' file appropriately to form the basis for your script.

Regards!

...JRF...
smatador
Honored Contributor

Re: Command execution at system startup

Hi,
Create a traditional script with something like
PATH=...
SHLIB_PATH=...
export PATH SHLIB_PATH
start(){
su user -c command_to_start_daemon
}
...
case "$1" in
start)
start;;
stop) the function for stopping/kill
;;
*) echo $"Usage :$0 (start|stop)
exit 1
;;
esac
and put it script on rc directory.

Hope it helps
Robert-Jan Goossens_1
Honored Contributor
Solution

Re: Command execution at system startup

Hi Din,

The easiest is to create a start/stop srcipt.

/sbin/init.d/template
Above is an example of a start/stop script, cp it your desired file name and customize the file.

You can use the "su - username -c /path/to_your_command" to execute as a specific user.

Create links to this script from the /etc/rc3.d where S is start and K is stop.

rc3 scripts will start at multiuser boot.

Hope this helps,
Robert-Jan
Tingli
Esteemed Contributor

Re: Command execution at system startup

Also, you need to create a file under /etc/rc.config.d which set up the switch for the start up and shutdown the daemon.
Din_1
Frequent Advisor

Re: Command execution at system startup

THanks all,

I got an idea on this issue

Regards,
Din
Din_1
Frequent Advisor

Re: Command execution at system startup

Thanks