 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Pinolo Guest
|
Posted: Fri Sep 26, 2003 5:11 pm Post subject: [mezzo OT] service Tomcat |
|
|
magari qualcuno di voi l'ha fatto:
come si fa a far partire tomcat sotto Linux come servizio?
tks
----------
Pinolo
|
|
| Back to top |
|
 |
shishii Guest
|
Posted: Sat Sep 27, 2003 1:00 pm Post subject: Re: [mezzo OT] service Tomcat |
|
|
Pinolo ha scritto:
| Quote: | magari qualcuno di voi l'ha fatto:
come si fa a far partire tomcat sotto Linux come servizio?
tks
----------
Pinolo
|
puoi usare questo script adattato da me:
---------------------------------------------------------------
#!/bin/sh
# chkconfig: - 98 11
# description: Start or stop the Tomcat server
#
### BEGIN INIT INFO
# Provides: catalina
# Required-Start: $network $syslog
# Required-Stop: $network
# Default-Start: 2 3 5
# Default-Stop: 0 1 6
# Description: Start or stop the Tomcat server
### END INIT INFO
# Source function library.
.. /etc/rc.d/init.d/functions
start=/opt/tomcat/bin/startup.sh
stop=/opt/tomcat/bin/shutdown.sh
pidFile=/opt/tomcat/catalina.pid
name='Tomcat'
JAVA_HOME=/usr/java/j2sdk1.4.2
CATALINA_HOME=/opt/tomcat
CATALINA_PID=/opt/tomcat/catalina.pid
export JAVA_HOME CATALINA_HOME CATALINA_PID
case "$1" in
'start')
$start >/dev/null 2>&1
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
action $"Starting $name: " /bin/true
else
action $"Starting $name: " /bin/false
fi
;;
'stop')
$stop >/dev/null 2>&1
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
action $"Stopping $name: " /bin/true
rm -f $pidFile
else
action $"Stopping $name: " /bin/false
fi
;;
'status')
if [ -s $pidFile ]; then
pid=`cat $pidFile`
kill -0 $pid >/dev/null 2>&1
if [ "$?" = "0" ]; then
echo "$name (pid $pid) is running"
RETVAL=0
else
echo "$name is stopped"
RETVAL=1
fi
else
echo "$name is stopped"
RETVAL=1
fi
;;
'restart')
$stop >/dev/null 2>&1
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
action $"Stopping $name: " /bin/true
rm -f $pidFile
else
action $"Stopping $name: " /bin/false
fi
$start >/dev/null 2>&1
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
action $"Starting $name: " /bin/true
else
action $"Starting $name: " /bin/false
fi
;;
*)
echo "Usage: $0 { start | stop | restart }"
RETVAL=1
;;
esac
exit $RETVAL
---------------------------------------------------------------
lo chiami "tomcat" e lo salvi in /etc/rc.d/init.d
poi a seconda della distro lo attivi. In RH si fa:
chkconfig --add tomcat
chkconfig --level 235 tomcat on
Ciao.
--
-- Marco Allegretti --
http://www.shishii.com
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|