Services

De WikiPlaceoweb
Aller à la navigationAller à la recherche

Les services (daemon)

Les services permettent de lancer ou non un programme en démon lors du démarrage du serveur ou d'un changement de level (runlevel).

Debian

Utilisez la commande update-rc.d pour créer les liens symboliques dans le bon /etc/rc?.d

Pour connaitre la liste des services de votre Debian, vous pouvez le faire en regardant votre runlevel et en listant les liens symboliques :

# runlevel
N 2
# cd /etc/rc2.d/
# ls -al
total 12
-rw-r--r--  1 root root  556 aoû 12  2008 README
lrwxrwxrwx  1 root root   17 aoû  4 12:54 S10rsyslog -> ../init.d/rsyslog
lrwxrwxrwx  1 root root   15 aoû  4 12:55 S12acpid -> ../init.d/acpid
lrwxrwxrwx  1 root root   15 aoû  4 14:22 S15bind9 -> ../init.d/bind9
lrwxrwxrwx  1 root root   16 aoû  4 14:22 S15lwresd -> ../init.d/lwresd
lrwxrwxrwx  1 root root   13 aoû  4 16:37 S16ssh -> ../init.d/ssh
lrwxrwxrwx  1 root root   15 aoû  4 14:22 S20exim4 -> ../init.d/exim4
lrwxrwxrwx  1 root root   20 aoû  4 14:22 S20nfs-common -> ../init.d/nfs-common
lrwxrwxrwx  1 root root   23 aoû  4 14:22 S20openbsd-inetd -> ../init.d/openbsd-inetd
lrwxrwxrwx  1 root root   15 aoû  4 16:47 S20rsync -> ../init.d/rsync
lrwxrwxrwx  1 root root   13 aoû  4 16:47 S23ntp -> ../init.d/ntp
lrwxrwxrwx  1 root root   13 aoû  4 14:22 S89atd -> ../init.d/atd
lrwxrwxrwx  1 root root   14 aoû  4 12:54 S89cron -> ../init.d/cron
lrwxrwxrwx  1 root root   17 aoû  4 14:22 S91apache2 -> ../init.d/apache2
lrwxrwxrwx  1 root root   18 aoû  4 12:54 S99rc.local -> ../init.d/rc.local
lrwxrwxrwx  1 root root   19 aoû  4 12:54 S99rmnologin -> ../init.d/rmnologin
lrwxrwxrwx  1 root root   23 aoû  4 12:54 S99stop-bootlogd -> ../init.d/stop-bootlogd

Le README contient :

The scripts in this directory are executed each time the system enters
this runlevel.

The scripts are all symbolic links whose targets are located in
/etc/init.d/ .

To disable a service in this runlevel, rename its script in this directory
so that the new name begins with a 'K' and a two-digit number, where the
number is the difference between the two-digit number following the 'S'
in its current name, and 100.  To re-enable the service, rename the script
back to its original name beginning with 'S'.

For a more information see /etc/init.d/README.

La commande update-rc.d

# update-rc.d
usage: update-rc.d [-n] [-f] <basename> remove
      update-rc.d [-n] <basename> defaults [NN | SS KK]
      update-rc.d [-n] <basename> start|stop NN runlvl [runlvl] [...] .
               -n: not really
               -f: force
update-rc.d rsync defaults
update-rc.d rsync remove
# update-rc.d rsync defaults
System startup links for /etc/init.d/rsync already exist.
# update-rc.d rsync remove
update-rc.d: /etc/init.d/rsync exists during rc.d purge (use -f to force)
# update-rc.d -f rsync remove
Removing any system startup links for /etc/init.d/rsync ...
  /etc/rc0.d/K20rsync
  /etc/rc1.d/K20rsync
  /etc/rc2.d/S20rsync
  /etc/rc3.d/S20rsync
  /etc/rc4.d/S20rsync
  /etc/rc5.d/S20rsync
  /etc/rc6.d/K20rsync
# update-rc.d rsync defaults
Adding system startup for /etc/init.d/rsync ...
  /etc/rc0.d/K20rsync -> ../init.d/rsync
  /etc/rc1.d/K20rsync -> ../init.d/rsync
  /etc/rc6.d/K20rsync -> ../init.d/rsync
  /etc/rc2.d/S20rsync -> ../init.d/rsync
  /etc/rc3.d/S20rsync -> ../init.d/rsync
  /etc/rc4.d/S20rsync -> ../init.d/rsync
  /etc/rc5.d/S20rsync -> ../init.d/rsync


REHL

chkconfig