Créer un service pour Tomcat
Bonjour,
j'essaye de réaliser un service pour mon Tomcat afin d'éviter à le redémarrer si je reboote ma machine Linux (distribution centOs).
Etant vraiment un novice dans le monde linux, j'ai tenté de mettre en place les scripts qu'on peut trouver sur le net. :oops:
J'ai une erreur que je ne comprends pas, à savoir sur la ligne suivante :
Code:
. /etc/rc.d/init.d/functions
où ma console me dit :
Citation:
: Aucun fichier ou répertoire de ce typeit.d/functions
J'ai regardé, j'ai bien un fichier functions dans /etc/rc.d/init.d/
Pour créer mon service, j'ai copié mon fichier nommé "tomcat" dans /etc/rc.d/init.d/ et tapez les lignes suivantes pour le lancer :
Code:
1 2 3
| chmod a+x tomcat
chkconfig --add tomcat
service tomcat start |
Voici ci-joint le fameux fichier Tomcat. Toute aide ou piste pour m'éclairer sur mon erreur est la bienvenue...
Merci
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
| # This is the init script for starting up the
# Jakarta Tomcat server
#
# chkconfig: 345 91 10
# description: Starts and stops the Tomcat daemon.
#
# Source function library.
. /etc/rc.d/init.d/functions
#
# Get config.
. /etc/sysconfig/network
#
# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0
#
tomcat=/opt/apache-tomcat-6.0.18
startup=$tomcat/bin/startup.sh
shutdown=$tomcat/bin/shutdown.sh
export JAVA_HOME=/usr/local/java/jdk
#
start(){
echo -n $"Starting Tomcat service: "
#daemon -c
$startup
RETVAL=$?
}
#
stop(){
action $"Stopping Tomcat service: " $shutdown
RETVAL=$?
}
#
restart(){
stop
start
}
#
status(){
numproc=`ps -ef | grep catalina | grep -v "grep catalina" | wc -l`
if [ $numproc -gt 0 ]; then
echo "Tomcat is running..."
else
echo "Tomcat is stopped..."
fi
}
#
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
exit 1
esac
#
exit 0 |