Operating System - HP-UX
1834934 Members
2669 Online
110071 Solutions
New Discussion

Re: Application start up when Machine starts

 
SOLVED
Go to solution
Ahmed_41
Super Advisor

Application start up when Machine starts

Dear All,

i am running OpenView NNM on an HPUX 11.11 server, i need to do the following, i need everytime the servers starts or reboots some openview maps are started and opend
usually i do this from shell using
ovw -map mapname and some other parameters
can someone tell me in details where to change or add this file so as i can make these ovw sessions starts everytime the machine starts ???

Thanks
9 REPLIES 9
Stf
Esteemed Contributor

Re: Application start up when Machine starts

Hello,

you can add an entry in /sbin/rc3.d for your ovw session to start when you start in normal mode.

you have to add a file beginning by Sxxxovw.rc

and you type your command to start your application, don't forget to add entire path for your command...

Stf ;-)
Victor BERRIDGE
Honored Contributor

Re: Application start up when Machine starts

Hi,
You will have to write a Startup/Shutdown script... Depending on how purist you are: HPUX separates script execution and script variable into 2 different locations...

For the Startup/Shutdown script that you should put in /sbin/init.d there is a model called template at that location so you can copy it and customize to your needs
Then you just have to link to the init level you want your script to be executed at as S<scriptmane> and at the previous level in a K<scriptmane> for the Shutdown sequence

All the best
Victor
Steven E. Protter
Exalted Contributor
Solution

Re: Application start up when Machine starts

Overview:

All actual startup scripts are in /sbin/init.d

To get a program to start up at boot time you set up a soft link in the run level directory desired.

Lets say you want the program to start at run level 3.

cd /sbin/rc3.d

ln -s /sbin/init.d/startprogram S880ovmstart

This says fire up startprogram in run level 3.

It is equivalent to this command line:

/sbin/init.d/startprogram start

Its usually a good idea to set up a kill to stop the program.

cd /sbin/rc2.d

ln -s /sbin/init.d/startprogram K120ovmstop

You can write a fresh startup script in /sbin/init.d

cd /sbin/init.d

cp template startupscript

You can then put your command line in the way you want. Remember, start scripts don't have an environment. If you need a PATH you must set it.

If you have the OpenView NNM program already auto starting, you may be able to add an additional command line and option to the startup script in /sbin/init.d

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Sanjay_6
Honored Contributor

Re: Application start up when Machine starts

Hi Ahmed,

Maybe this doc will help you understand the concept and write a small script for the startup/shitdown of the app.

http://docs.hp.com/hpux/onlinedocs/os/startup.pdf

Hope this helps.

Regds
Bill Hassell
Honored Contributor

Re: Application start up when Machine starts

I've attached a more modern template file. You'll find the old version in /sbin/init.d/template. Read the comments in the template file, make a copy and modify it to fit your needs. There is also a parameter file in /etc/rc.config.d where you can put values to sent to the start/stop script.

NOTE: start/stop scripts are executed before logins or other network tasks are completed so if ovw is the interactive program, it will fail because there is no place to display the program yet. If you want ovw to come up as you login, just add the code to your local .profile.


Bill Hassell, sysadmin
Ermin Borovac
Honored Contributor

Re: Application start up when Machine starts

ovw is GUI application so you won't able to start it until you have X server running. If you are using CDE you can have it started automatically when you log in. Create $HOME/.dt/sessions/sessionetc file and make it executable. Place the following lines in sessionetc file.

#!/usr/bin/sh
/opt/OV/bin/ovw -map

Ahmed_41
Super Advisor

Re: Application start up when Machine starts

Guys,
that was a very good answers actually, now i know about startup and shutdown scripts. this is very good

let me get back to one point here please, ovw will try to open a gui, so as stated last it needs x server to be running.

isnt xserver will be running since the machine is starting up ??? xserver will start automatically i think?? right ?

so i just need to put my script to run after the xserver script runs so as i am sure that xserver is running , am i correct about this ??? or xserver only runs when some user logins over cde ???

please i need to know this more in details as you did guys with the startup/shutdown scripts.

Thanks in advance
Ermin Borovac
Honored Contributor

Re: Application start up when Machine starts

Before you run ovw you must have shell environment variable called DISPLAY defined.

$ echo $DISPLAY
:0.0

This variable shows where X server is (at hostname). When you run ovw GUI, it will try to display its window at :0.0.

For example if you are connecting to your NNM server from a PC running MS Windows, your PC must be running some flavour of X server emulation software (e.g. ReflectionX).
Bill Hassell
Honored Contributor

Re: Application start up when Machine starts

Sorry, I forgot the attachment. As far as a graphics program starting up, there is a rather large difference between the Xwindow code that provides a desktop and your display. Your display is unavailable until you actually login. That's because the workstation display must be enabled to act as a display server. Herein lies some confusion about servers and clients when it comes to Xwindows. Your display, whether attached to a workstation or emulated with special PC software, must be enabled to be a display server. The Xserver software is actually a client program and does not display anything until requested. Whether a PC or local workstation, the desktop manager (CDE) will not show anything until the display is ready to accept Xwindow traffic.

Now you *can* start the ovw program and give it the address of an already-running display server (another workstation or perhaps a PC already running an Xwindow emulator) by including the -display option as in:

ovw -display 12.34.56.78:0 -map mapname ...

Now this IPaddress can't be the local workstation because it isn't a display server yet. I used to run several Glance sessions and an ovw display on an Xwindow terminal. The Xwindow terminal is always running and can be configured to accept displays from any source.

So for your solution, create a permenent Xwindow server somewhere and display ovw there, or add ovw to your login profile on the local system.


Bill Hassell, sysadmin