Operating System - HP-UX
1752794 Members
6059 Online
108789 Solutions
New Discussion юеВ

Re: Background script to be run

 
SOLVED
Go to solution
Prashantj
Valued Contributor

Background script to be run

Hi Guru,

I am working on sap and IVM environment. I want to set the following script in background always. If server is reboot in that case also the script should automatically starts.

cd /usr/sap/saprouter
./saprouter -r -K "p:CN=rusolman, OU=0001128964, OU=SAProuter, O=SAP, C=DE"


Regards
Prashant
Good judgment comes from experience and experience comes from bad judgment.
6 REPLIES 6
Dennis Handly
Acclaimed Contributor

Re: Background script to be run

>If server is rebooted, also the script should automatically starts.

If you want the script to run all the time and to be automatically started, you might want to look into rc(1m):
http://docs.hp.com/en/B2355-60130/rc.1M.html
Emil Velez
Honored Contributor

Re: Background script to be run

cp /sbin/init.d/template /sbin/init.d/sap

ln -s /sbin/init.d/sap /sbin/rc4.d/s900sap
ln -s /sbin/init.d/sap /sbin/rc3.d/k100sap

vi /sbin/init.d/sap

look for the section that says start command and put the line in there.

look for the section that says stop command and put a command to stop the application there.

Jim Walls
Trusted Contributor
Solution

Re: Background script to be run


If you need to ensure the router is always running you could get the init process to manage it. Put a line similar to this into /etc/inittab.

sap1:2345:respawn:/usr/sap/saprouter/saprouter -r -K "p:CN=rusolman, OU=0001128964, OU=SAProuter, O=SAP, C=DE"

Where "sap1" is a unique label. The process will always be started in any of the listed run levels (2,3,4 or 5)

and then call the following command to start it:

init q

See the documentation for more information:
man init
man inittab

To inhibit the process from running, comment out the line in /etc/inittab, call init q and then kill any running saprouter processe(s).



Prashantj
Valued Contributor

Re: Background script to be run

Hi,

Thanks for your reply. i put the following entry in /etc/inittab and run init q but it was not worked out.

sap1:2345:respawn:/usr/sap/saprouter/rulsaprouter/saprouter -r -K "p:CN=rusolman, OU=0001128964, OU=SAProuter, O=SAP, C=DE"

Please advice any other changes require ?

Thanks & Regards
Prashant
Good judgment comes from experience and experience comes from bad judgment.
Peter Nikitka
Honored Contributor

Re: Background script to be run

Hi Prashant,

1) did you enter the string as a one-liner in /etc/inittab?

2) Any messages about your entry in the syslog?

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Prashantj
Valued Contributor

Re: Background script to be run

Hi Peter,

1) Yes, the string is in one line

2) NO.

Prashant
Good judgment comes from experience and experience comes from bad judgment.