Mailinglist Archive: opensuse (5130 mails)

< Previous Next >
Re: [SLE] Services in rc<x>.d directories
  • From: Leendert Meyer <leen.meyer@xxxxxxx>
  • Date: Sat, 20 May 2006 12:13:05 +0200
  • Message-id: <200605201213.05334.leen.meyer@xxxxxxx>
On Saturday 20 May 2006 11:40, Sergey Mkrtchyan wrote:
> Hi folks!

Hi folk! ;)

> I have got some questionS concerning the services which starts at
> runlevels. First one is: In the /etc/init.d/rc<x>.d directory symbolic
> links to the appropriate executable files, And there are two links for each
> program(one for killing it - the name starting with "K", and one for
> starting - name starting with "S").
> So first question is: How the two links pointing to the same file works
> in a different way, in one case the same file kills the process, in the
> next it starts...As I know there isn't any parameters for the links?
> Do I understand it correctly?

1. Did you read /etc/init.d/README and /etc/init.d/skeleton? Also 'man
insserv' (the 'DESCRIPTION' section) has usefull info.

2. The glue is /etc/init.d/rc. It calls the S??xxx scripts with the 'start'
parameter, and the K??xxx with the stop parameter.

> And next one is: I just want to add something(for example xmms) to start
> automaticaly in runlevel 5, so in my /etc/init.d/rc5.d directory I
> created symbolic link to /usr/bin/xmms executable file with a name like
> S22xmms, I was thinking how to create another link with K22xmms, but
> didn't find the answer.

Use the section between the '### BEGIN INIT INFO' and '### END INIT INFO'
marks to indicate when the script should start, and what services it depends
on. See /etc/init.d/skeleton, and 'man insserv'.

> Anyway it didn't worked after restarting...I
> tried to add it using chkconfig...like
>
> linux:~/Install # chkconfig -a /usr/bin/xmms
> /usr/bin/xmms: unknown service
> /usr/bin/xmms: not a runlevel service

The initscripts need to be in /etc/init.d by convention (LSB I think). Also,
when creating a new service, it might be a good idea to start
from /etc/init.d/skeleton. You do not need all of it, see the init.d/
directory for plenty of examples. ;)

> and in yast's part of System Services (Runlevel) I didn't find anyway to
> "add" something

YaST probably looks only in /etc/init.d/. The "adding" of a new service should
be done e.g. manually by creating a new script in /etc/init.d/. After that,
you can "add" (= enable) the service with e.g. YaST, chkconfig or insserv,
which creates the appropriate symlinks.

> Is it some default set of programs to start at booting and there can't
> be added anything?

? No.

> And I was wondering why the numbers of links is not in the increasing
> order...In my case the /etc/init.d/rc5.d content is:
>
> . K05nscd K10microcode and so on...with
> .. K05postfix K10splash appropriate "S" ones
> K01cupsrenice K05xdm K10sshd
> K02powersaved K06cups K12nfs
> K03haldaemon K07mdnsd K12nfsboot
> K04cron K10acpid K14portmap
> K04smbfs K10alsasound K14splash_early

Because some scripts do not depend upon eachother; it is possible to start
them at the same time (in parallel).

> I can assume that the same numbers is for the processes to start
> simultaneously(please correct me if I am not right), but why for example
> From K07mdnsd comes K10acpid and not K08 acpid?

The answer is between the '### BEGIN INIT INFO' and '### END INIT INFO'
sections (hint: default-start/stop; see 'man insserv' for a better
explanation).

AFAIK, the assignment of the numbers is done automatically by chkconfig or
insserv, and can change after inserting or removing a service. After all, the
number itself is not important; only the order is.

BTW, doesn't xmms depend on X? If it can run without X, then no worries.

Cheers,

Leen

< Previous Next >
References