Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 19/05/2010, à 18:58

Arkanium

httpd ne s'exécute pas au démarrage (update-rc.d)

Salut !

Après avoir cherché en vain une solution je me tourne vers ce forum
( cf post : http://forum.ubuntu-fr.org/viewtopic.ph … 1#p3487411 )

Je rencontre un petit problème avec le service apache refusant de se lancer automatique.
Je suis sous lucid 10.04, 64 bits.

J'ai fait une installation manuelle d'apache (2.2) qui fonctionne à merveille (/etc/init.d/httpd start),
Mis mon apachectl dans init.d

sudo cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd

,
puis fait un

sudo update-rc.d httpd default

ou encore un

sudo update-rc.d httpd start 91 2 3 4 5 . stop 09 0 1 6 .

Ce qui m'ajoute correctement les entrées dans les différents rcX.d

Toutefois au démarrage comme à l'arrêt ... rien ne se passe
Le fichier est bien exécutable, appartient bien à root, les chemins sont bons,...
Et si j'exécute manuellement en faisant un

sudo /etc/rcX.d/httpd -k start

ça fonctionne ...

Voici le script permettant de lancer le deamon

#!/bin/sh
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Apache control script designed to allow an easy command line interface
# to controlling Apache.  Written by Marc Slemko, 1997/08/23
# 
# The exit codes returned are:
#   XXX this doc is no longer correct now that the interesting
#   XXX functions are handled by httpd
#	0 - operation completed successfully
#	1 - 
#	2 - usage error
#	3 - httpd could not be started
#	4 - httpd could not be stopped
#	5 - httpd could not be started during a restart
#	6 - httpd could not be restarted during a restart
#	7 - httpd could not be restarted during a graceful restart
#	8 - configuration syntax error
#
# When multiple arguments are given, only the error from the _last_
# one is reported.  Run "apachectl help" for usage info
#
ARGV="$@"
#
# |||||||||||||||||||| START CONFIGURATION SECTION  ||||||||||||||||||||
# --------------------                              --------------------
# 
# the path to your httpd binary, including options if necessary
HTTPD='/usr/local/apache2/bin/httpd'
#
# pick up any necessary environment variables
if test -f /usr/local/apache2/bin/envvars; then
  . /usr/local/apache2/bin/envvars
fi
#
# a command that outputs a formatted text version of the HTML at the
# url given on the command line.  Designed for lynx, however other
# programs may work.  
LYNX="lynx -dump"
#
# the URL to your server's mod_status status page.  If you do not
# have one, then status and fullstatus will not work.
STATUSURL="http://localhost:80/server-status"
#
# Set this variable to a command that increases the maximum
# number of file descriptors allowed per child process. This is
# critical for configurations that use many file descriptors,
# such as mass vhosting, or a multithreaded server.
ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`"
# --------------------                              --------------------
# ||||||||||||||||||||   END CONFIGURATION SECTION  ||||||||||||||||||||

# Set the maximum number of file descriptors allowed per child process.
if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then
    $ULIMIT_MAX_FILES
fi

ERROR=0
if [ "x$ARGV" = "x" ] ; then 
    ARGV="-h"
fi

case $ARGV in
start|stop|restart|graceful|graceful-stop)
    "/usr/local/apache2/bin/httpd" -k "start"
    ERROR=$?
    ;;
startssl|sslstart|start-SSL)
    echo The startssl option is no longer supported.
    echo Please edit httpd.conf to include the SSL configuration settings
    echo and then use "apachectl start".
    ERROR=2
    ;;
configtest)
    $HTTPD -t
    ERROR=$?
    ;;
status)
    $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
    ;;
fullstatus)
    $LYNX $STATUSURL
    ;;
*)
    $HTTPD $ARGV
    ERROR=$?
esac

exit $ERROR

Mon runlevel est :

 /sbin/runlevel : N 2

Si vous avez des pistes ?

En vous remerciant par avance

Hors ligne

#2 Le 20/05/2010, à 09:16

boogy

Re : httpd ne s'exécute pas au démarrage (update-rc.d)

as tu créer un groupe/user  httpd ou apache.. je crois que ces fichiers doivent appartenir a un user apache et un groupe apache et non pas a root si je ne me trompe pas (veuillez me corriger si je me trompe)

y-a-t-il qlq chose dans les logs d'apache? et tu sur d'avoir installer toutes les dépendances ?

apt-cache depends apache2
ou
dpkg-deb --info apache2

WHERE THERE IS A SHELL, THERE IS A WAY
Success is to be measured not so much by the position that one has reached in life as by the obstacles which he has overcome.
Documentation
www.tuxgeek.org

Hors ligne

#3 Le 20/05/2010, à 11:00

Arkanium

Re : httpd ne s'exécute pas au démarrage (update-rc.d)

Non je n'ai pas créé d'utilisateur ou de groupe apache. J'ai simplement suivi les directives préconisées par Apache ici.
Donc j'ai compilé et installé Apache 2.2. Au niveau des dépendances Je ne vois pas ce qui pourrait me manquer étant donné que tout marche (testé en local et réseau local).

Les commandes donnent (n'oublie pas que je n'ai pas installé avec les dépôts ubuntu, mais avec la version téléchargée depuis le site apache, unix-source 2.2.15, avec l'apr util inclus) :

dpkg-deb --info apache2
dpkg-deb: impossible de lire l'archive « apache2 »: Aucun fichier ou dossier de ce type

apt-cache depends apache2
apache2
 |Dépend: apache2-mpm-worker
 |Dépend: apache2-mpm-prefork
 |Dépend: apache2-mpm-event
  Dépend: apache2-mpm-itk
  Dépend: apache2.2-common

Apache fonctionne très bien, il ne me pose aucun problème, aucun message d'erreur, etc

Il reste seul le problème (à mon humble avis) de le faire démarrer en même temps que le système.

Dis moi s'il te faut autre chose. Merci wink

Hors ligne

#4 Le 20/05/2010, à 16:29

vivienfr

Re : httpd ne s'exécute pas au démarrage (update-rc.d)

Bonjour,

Il me semble que depuis Ubuntu 10.04, les scripts rc.d ne sont plus exécutes au démarrage. Le lancement de script doit se faire par upstart de mémoire.

Le but est d'optimiser le temps de démarrage en démarrant les programme en // et non les un après les autres.

sudo update-rc.d httpd start 91 2 3 4 5 . stop 09 0 1 6 . n'est pour moi plus utilisable avec Ubuntu 10.04


fr.archive.ubuntu.com : Statistiques sur les versions d'Ubuntu en France

Hors ligne

#5 Le 20/05/2010, à 18:12

Arkanium

Re : httpd ne s'exécute pas au démarrage (update-rc.d)

Ok je veux bien essayer avec upstart, mais il va me falloir un peu d'aide ...

J'ai consulté de la doc sur le web et bien sur les man du système sur upstart et initctl
(ici ou encore ici)

J'avoue ne pas tout comprendre. D'une part on entend souvent parler du répertoire /etc/event.d
Mais pas de traces dans etc (sauf des sous répertoires de différentes applis ou conf nommés ainsi comme /etc/dbus-1/envent.d ou /etc/apm/event.d.

Donc le répertoire n'existe pas je le créé (?), j'y ajoute mes scripts
exemple pour démarrer apache (s'il y a erreur c'est mon premier essai hmm)

start on stopped rc2
start on stopped rc3
start on stopped rc4
start on stopped rc5

respawn
exec /etc/apache2/bin/httpd -k gracefu

Ensuite ... je suis perdu. Je ne vois pas ce qu'il faut faire exactement.
Doit-on faire une commande pour initialiser le tout ? Doit-on inscrire ce script dans un fichier de conf ? ... etc ...

Edit : update-rc.d n'est pas totalement mort puisque je parviens quand même à exécuter au démarrage mon script d'initialisation d'iptables.

Dernière modification par Arkanium (Le 20/05/2010, à 18:34)

Hors ligne