Operating System - HP-UX
1831320 Members
3154 Online
110023 Solutions
New Discussion

How to define a service ?

 
Charu
New Member

How to define a service ?

Hi,
I want to run a command which should start and stop along with the server.
This is an application command ( rfcserv -a ABCD -g XYZ -x ASDF01 -t )which should run in the background and work like other services in the system.
Currently I am running the above command manually, but when the server is rebooted, I have to again run the command manually after the system is booted. How do I automate this?
6 REPLIES 6
Arunvijai_4
Honored Contributor

Re: How to define a service ?

Just put your command in /etc/profile. It will run everytime when server reboots.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Raj D.
Honored Contributor

Re: How to define a service ?


Hi Charu,

You have to put this command in
1. /etc/rc.config.d/ [ Config file ]
and
2. /sbin/rc#.d/SXX_yourfile [ Execution script link ]

and
3. /sbin/init.d/filename [ Execution script]

Cheers,
Raj
" If u think u can , If u think u cannot , - You are always Right . "
VEL_1
Valued Contributor

Re: How to define a service ?


You have to rc scripts. Just see the below itrc thread:

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=956990

Raj D.
Honored Contributor

Re: How to define a service ?

Charu ,

You can also put it in /etc/inittab for starting at boot time,

like this :

mysv:234:once:sh /mydir/rfcserv -a ABCD -g XYZ -x ASDF01 -t > /dev/null 2>&1

Though configuring through /etc/rc.config.d/ and /sbin/rc#.d/ give you much control to start and stop with system start and shutdown..


Enjoy..
Cheers,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "
Muthukumar_5
Honored Contributor

Re: How to define a service ?

Create RC script to start rfcserv command.

See the /sbin/init.d/ It is having format of start / stop / restart to start service.

You have link to /sbin/rc.d/Sservice to /sbin/init.d/service.

S denotes starting in /sbin/rc.d/
K denotes stoping in /sbin/rc.d/

Look /sbin/init.d/cron file.

Else,

In /etc/rc.config file put as,

rfcserv -a ABCD -g XYZ -x ASDF01 -t 1>/dev/null 2>&1 &

hth.
Easy to suggest when don't know about the problem!
Raj D.
Honored Contributor

Re: How to define a service ?

Charu ,

Here is a good doc that will help you configuring auto startup service,

Cheers,
Raj,
" If u think u can , If u think u cannot , - You are always Right . "