public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* Re: [gentoo-dev] writing net.xx style init script
  2006-08-20 12:01 [gentoo-dev] writing net.xx style init script paul kölle
@ 2006-08-20 11:19 ` Marius Mauch
  2006-08-20 12:11 ` Mike Frysinger
  2006-08-20 12:39 ` Roy Marples
  2 siblings, 0 replies; 6+ messages in thread
From: Marius Mauch @ 2006-08-20 11:19 UTC (permalink / raw
  To: gentoo-dev

paul kölle schrieb:
> Hi all,
> 
> I need to write an init-script for multiple instances of the same
> service with different configurations (need to start/stop them
> individually) similar to what the net.xx scripts do.
> 
> I thought I could get the instance name from $0 and use it as a key to
> look up the configuration in /etc/conf.d/servicename but $0 is always
> /sbin/runscript.sh. The net.xx scripts know the name as ${IFACE} in
> start() without doing something obvious... How do I get the name of the
> called script in /etc/init.d? Better ideas?

Take a look at the sshd init script.

Marius
-- 
gentoo-dev@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [gentoo-dev] writing net.xx style init script
@ 2006-08-20 12:01 paul kölle
  2006-08-20 11:19 ` Marius Mauch
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: paul kölle @ 2006-08-20 12:01 UTC (permalink / raw
  To: gentoo-dev

Hi all,

I need to write an init-script for multiple instances of the same
service with different configurations (need to start/stop them
individually) similar to what the net.xx scripts do.

I thought I could get the instance name from $0 and use it as a key to
look up the configuration in /etc/conf.d/servicename but $0 is always
/sbin/runscript.sh. The net.xx scripts know the name as ${IFACE} in
start() without doing something obvious... How do I get the name of the
called script in /etc/init.d? Better ideas?

thanks
 Paul
-- 
gentoo-dev@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-dev] writing net.xx style init script
  2006-08-20 12:01 [gentoo-dev] writing net.xx style init script paul kölle
  2006-08-20 11:19 ` Marius Mauch
@ 2006-08-20 12:11 ` Mike Frysinger
  2006-08-20 15:22   ` paul kölle
  2006-08-20 12:39 ` Roy Marples
  2 siblings, 1 reply; 6+ messages in thread
From: Mike Frysinger @ 2006-08-20 12:11 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 199 bytes --]

On Sunday 20 August 2006 08:01, paul kölle wrote:
> How do I get the name of the called script in /etc/init.d? Better ideas? 

use $SVCNAME

see the sshd init.d script for some examples
-mike

[-- Attachment #2: Type: application/pgp-signature, Size: 827 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-dev] writing net.xx style init script
  2006-08-20 12:01 [gentoo-dev] writing net.xx style init script paul kölle
  2006-08-20 11:19 ` Marius Mauch
  2006-08-20 12:11 ` Mike Frysinger
@ 2006-08-20 12:39 ` Roy Marples
  2 siblings, 0 replies; 6+ messages in thread
From: Roy Marples @ 2006-08-20 12:39 UTC (permalink / raw
  To: gentoo-dev

On Sunday 20 August 2006 13:01, paul kölle wrote:
> I need to write an init-script for multiple instances of the same
> service with different configurations (need to start/stop them
> individually) similar to what the net.xx scripts do.

Sounds like you want to look at the openvpn or vsftpd init scripts as they 
allow multiplexing, which I think is what you are after.

Thanks

-- 
Roy Marples <uberlord@gentoo.org>
Gentoo/Linux Developer (baselayout, networking)

-- 
gentoo-dev@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-dev] writing net.xx style init script
  2006-08-20 12:11 ` Mike Frysinger
@ 2006-08-20 15:22   ` paul kölle
  2006-08-20 21:00     ` Mike Frysinger
  0 siblings, 1 reply; 6+ messages in thread
From: paul kölle @ 2006-08-20 15:22 UTC (permalink / raw
  To: gentoo-dev

Mike Frysinger wrote:
> On Sunday 20 August 2006 08:01, paul kölle wrote:
>> How do I get the name of the called script in /etc/init.d? Better ideas? 
> 
> use $SVCNAME
> 
> see the sshd init.d script for some examples
thanks mike, you got me started ;)

actually there is plenty of choice here:

gentoo ~ # cat /etc/init.d/dummy
#!/sbin/runscript


start() {
        einfo "$(set)"
}

leads to:
gentoo ~ # ls -l /etc/init.d/
.
-rwxr-x---  1 root  root    267 Aug 20 17:10 dummy2
lrwxrwxrwx  1 root  root     18 Aug 20 17:12 dummy2.v1 -> /etc/init.d/dummy2
.

gentoo ~ # /etc/init.d/dummy2.v1 start
 * rc_name is: dummy2.v1
 * myservice is: dummy2.v1
 * myscript is: /etc/init.d/dummy2.v1
 * SVCNAME is: dummy2.v1
 * BASH_ARGV[1]: /etc/init.d/dummy2.v1
 * BASH_SOURCE[0]: /etc/init.d/dummy2.v1

I'll stick with SVCNAME for now ;)

thanks again,
 Paul

-- 
gentoo-dev@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-dev] writing net.xx style init script
  2006-08-20 15:22   ` paul kölle
@ 2006-08-20 21:00     ` Mike Frysinger
  0 siblings, 0 replies; 6+ messages in thread
From: Mike Frysinger @ 2006-08-20 21:00 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 541 bytes --]

On Sunday 20 August 2006 11:22, paul kölle wrote:
> Mike Frysinger wrote:
> > On Sunday 20 August 2006 08:01, paul kölle wrote:
> >> How do I get the name of the called script in /etc/init.d? Better ideas?
> >
> > use $SVCNAME
> >
> > see the sshd init.d script for some examples
>
> thanks mike, you got me started ;)
>
> actually there is plenty of choice here:

no, there isnt ... SVCNAME is the only one the base-layout team guarantees we 
wont change ... if we can figure out a way to break the others, we will ;)
-mike

[-- Attachment #2: Type: application/pgp-signature, Size: 827 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-08-20 21:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-20 12:01 [gentoo-dev] writing net.xx style init script paul kölle
2006-08-20 11:19 ` Marius Mauch
2006-08-20 12:11 ` Mike Frysinger
2006-08-20 15:22   ` paul kölle
2006-08-20 21:00     ` Mike Frysinger
2006-08-20 12:39 ` Roy Marples

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox