How do I register a service?

I have a couple of services I need to run from init.d for runlevel 2.
One of them depends on networking, so of course I supply the lines

# Provides: pyTivo
# Required-Start: $syslog $network

at the top of the init script. The second service, however relies on
the first one, so I need to make sure it is not run until the first is
up. It seemed to me I could guarantee the script order by putting

# Required-Start: $syslog $network $pyTivo

at the top of the second script, but now I'm not so sure. The
networking script has

# Provides: networking

instead of

# Provides: network

which is what I would expect if the mechanism worked as I had surmised.
How do I guarantee the script order is maintained by update-rc.d?

0
Your rating: None

Comments

How do I register a service?

On Mon, 30 May 2011 11:40:02 -0500, lrhorer wrote:

> I have a couple of services I need to run from init.d for runlevel 2.
> One of them depends on networking, so of course I supply the lines
>
> # Provides: pyTivo
> # Required-Start: $syslog $network
>
> at the top of the init script. The second service, however relies on
> the first one, so I need to make sure it is not run until the first is
> up. It seemed to me I could guarantee the script order by putting
>
> # Required-Start: $syslog $network $pyTivo
>
> at the top of the second script, but now I'm not so sure.

That makes sense to me :-?

> The networking script has
>
> # Provides: networking
>
> instead of
>
> # Provides: network
>
> which is what I would expect if the mechanism worked as I had surmised.
> How do I guarantee the script order is maintained by update-rc.d?

You mean what's the difference between "$network" and "networking" in
LSB parlance?

http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/facilname.html

THT

Greetings,

How do I register a service?

Camaleón wrote:

> On Mon, 30 May 2011 11:40:02 -0500, lrhorer wrote:
>
>> I have a couple of services I need to run from init.d for runlevel 2.
>> One of them depends on networking, so of course I supply the lines
>>
>> # Provides: pyTivo
>> # Required-Start: $syslog $network
>>
>> at the top of the init script. The second service, however relies on
>> the first one, so I need to make sure it is not run until the first
>> is
>> up. It seemed to me I could guarantee the script order by putting
>>
>> # Required-Start: $syslog $network $pyTivo
>>
>> at the top of the second script, but now I'm not so sure.
>
> That makes sense to me :-?
>
>> The networking script has
>>
>> # Provides: networking
>>
>> instead of
>>
>> # Provides: network
>>
>> which is what I would expect if the mechanism worked as I had
>> surmised. How do I guarantee the script order is maintained by
>> update-rc.d?
>
> You mean what's the difference between "$network" and "networking" in
> LSB parlance?

Nevermind. I found it. I should be using insserv
instead of update-rc.d

How do I register a service?

On Mon, 30 May 2011 12:57:14 -0500, lrhorer wrote:

> Camaleón wrote:
>
>> On Mon, 30 May 2011 11:40:02 -0500, lrhorer wrote:

(...)

>>> The networking script has
>>>
>>> # Provides: networking
>>>
>>> instead of
>>>
>>> # Provides: network
>>>
>>> which is what I would expect if the mechanism worked as I had
>>> surmised. How do I guarantee the script order is maintained by
>>> update-rc.d?
>>
>> You mean what's the difference between "$network" and "networking" in
>> LSB parlance?
>
> Nevermind. I found it. I should be using insserv
> instead of update-rc.d

Ah, that. Yep, "man update-rc.d" should also point to "insserv".

Greetings,

How do I register a service?

Camaleón wrote:

> On Mon, 30 May 2011 12:57:14 -0500, lrhorer wrote:
>
>> Camaleón wrote:
>>
>>> On Mon, 30 May 2011 11:40:02 -0500, lrhorer wrote:
>
> (...)
>
>>>> The networking script has
>>>>
>>>> # Provides: networking
>>>>
>>>> instead of
>>>>
>>>> # Provides: network
>>>>
>>>> which is what I would expect if the mechanism worked as I had
>>>> surmised. How do I guarantee the script order is maintained by
>>>> update-rc.d?
>>>
>>> You mean what's the difference between "$network" and "networking"
>>> in LSB parlance?
>>
>> Nevermind. I found it. I should be using insserv
>> instead of update-rc.d
>
> Ah, that. Yep, "man update-rc.d" should also point to "insserv".
>
> Greetings,
>
OK, wait a minute. It should work, but it isn't.

Here is pyHME:

#! /bin/sh
### BEGIN INIT INFO
# Provides: pyHME
# Required-Start: $remote_fs $syslog $network $pyTivo
# Required-Stop: $remote_fs $syslog $network $pyTivo
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: HME Services
# Description: Provides HME services for TiVo
#
### END INIT INFO

but when I run `insserv pyHME` I get:

RAID-Server:/etc/rc2.d# ls -1 *py*
S04pyHME
S04pyTivo

That will run pyHME before pyTivo. What am I doing wrong?

Syndicate content