anotaciones que no quiero recordar, ni olvidar

me

Script para crear el servicio Tomcat y que arranque con el sistema

Ratio: 5 / 5

Iniciar activoIniciar activoIniciar activoIniciar activoIniciar activo
 

Pues eso, que como cuando instalas Tomcat no lo hace por si sólo, conviene hacerlo.
Creamos el fichero en el directorio de servicios con:

Mostrar/Ocultar código bash

Ver código
vim /etc/init.d/tomcat

Y luego pegamos esto (revisa que las rutas sean correctas):

Mostrar/Ocultar código bash

Ver código
#!/bin/sh
#
# chkconfig: 2345 20 80
# description: Tomcat
#
start()
{
    su - root -c /usr/local/tomcat7/bin/startup.sh
}
 
stop()
{
    su - root -c /usr/local/tomcat7/bin/shutdown.sh
}
 
case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    *)
        echo $"Usage: $0 {start|stop}"
        exit 1
esac

Luego le damos permisos de ejecución (755) y para terminar le decimos que arranque con el CentOS:

Mostrar/Ocultar código bash

Ver código
chkconfig --add tomcat