Operating System - HP-UX
1752337 Members
5706 Online
108787 Solutions
New Discussion

Re: Adding script in startup

 
Abubakkar
Frequent Contributor

Adding script in startup

Dear friends,

I am very new in hpux.

how to add my own script in startup. What are the steps. Kindly explain the any one.

4 REPLIES 4
Dennis Handly
Acclaimed Contributor

Re: Adding script in startup

Take a look at rc(1m).  There is a template you can use.

Johnson Punniyalingam
Honored Contributor

Re: Adding script in startup

Steps :-

 

1. deciced which run-level you want your script to be called (e.g) /sbin/rc1.d  or rc2.d or rc3.d 

2.  create file name for your script & create (soft-link) (e.g) /sbin/init.d/nfs.server

 

lrwxr-xr-x   1 root       root            23 May  9  2009 S100nfs.server -> /sbin/init.d/nfs.server

 

S100nfs.server -> softlink file name

 /sbin/init.d/nfs.server -> actual location of the file

 

regards

Problems are common to all, but attitude makes the difference
VK2COT
Honored Contributor

Re: Adding script in startup

Hello,

 

Here is the simple recipe for a new service, say, called myservice:

 

1.  cp /sbin/init.d/template /sbin/init.d/myservice

2.  vi /sbin/init.d/myservice

       a.   Edit start_msg statement

       b.   Edit stop_msg statement

       c.   Edit start statement

               i.  Change CONTROL_VARIABLE to MYSERVICE

              ii.  Add command to start your service

             iii.  Add command set_return

       d.   Edit stop statement

               i.  Change CONTROL_VARIABLE to MYSERVICE

              ii.  Add command to stop your service

             iii.  Add command set_return

3.  vi /etc/rc.config.d/myservice

       a.   Add single line, MYSERVICE=1

4.   ln -s /sbin/init.d/myservice /sbin/rc3.d/S900myservice

  ln -s /sbin/init.d/myservice /sbin/rc2.d/K100myservice

This is well described in HP-UX SNA II course.

 

Regards,

 

VK2COT

VK2COT - Dusan Baljevic
Andre Stewart
Frequent Advisor

Re: Adding script in startup

Don't forget to add the corresponding:

 

/etc/rc.config.d/myservice_CONTROL_FILE, to control startup (or no startup) during boot.