Problema creando un demonio en Debian Jessi

Iniciado por 5.1, 30 Septiembre 2017, 14:41 PM

0 Miembros y 1 Visitante están viendo este tema.

5.1

Buenas a todos, os explico mi problema.

He creado un script para iniciar como servicio una aplicación, tomcast para ser exactos.
El problema viene que no me inicia, os explico :

- Si hago un "service tomcast start" el resultado es que inicia pero no demoniza, hace un exited (igual que cuando arranca al inicio).
- Si primero hago un "service tomcast stop" y a continuación hago un start funciona perfectamente.
- Si hago un "service tomcast restart" funciona perfectamente.

Os dejo el code por si veis algo raro...
#! /bin/sh
### BEGIN INIT INFO
# Provides:          Tomcast
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Tomcast init script
# Description:       Launch tomcast at startup
### END INIT INFO

NAME="tomcast"
DESC="Demonio servicio Tomcast"
PIDFILE="/var/run/tomcast.pid"
LOGFILE="var/log/tomcast.log"
DAEMON="/usr/bin/tomcast"
DAEMON_OPTS="-o 10.5.0.85 -b 10.5.0.84 -p 8081 -t 100 -d ${PIDFILE} -c /etc/tomcast/channels.cfg"

test -x ${DAEMON} || exit 0
. /lib/lsb/init-functions

case "$1" in
   start)
       echo -n "Starting Tomcast"
       start-stop-daemon --start --pidfile ${PIDFILE} --exec ${DAEMON} -- ${DAEMON_OPTS}
       echo -n $?
       ;;
   stop)
       echo -n "Stopping Tomcast"
       start-stop-daemon --stop --pidfile ${PIDFILE}
       echo -n $?
       ;;
   force-reload|restart)
       $0 stop
       $0 start
       ;;
 *)
   echo "Usage: /etc/init.d/tomcast {start|stop|restart|force-reload}"
   exit 1
   ;;
esac


Desde ya muchas gracias y a ver si sois capaces de ayudarme a resolver el tema pq me está volviendo loco...

PD : Os amplio con más info ...

root@IPTV:/home/xxx# service tomcast start
root@IPTV:/home/xxx# service tomcast status
● tomcast.service - LSB: Tomcast init script
  Loaded: loaded (/etc/init.d/tomcast)
  Active: active (exited) since sáb 2017-09-30 16:07:12 CEST; 2min 18s ago

sep 30 16:07:12 IPTV tomcast[489]: Server ident      : unixsol/tomcast
sep 30 16:07:12 IPTV tomcast[489]: Channels file     : /etc/tomcast/channels.cfg
sep 30 16:07:12 IPTV tomcast[489]: Output iface addr : 10.5.0.85
sep 30 16:07:12 IPTV tomcast[489]: Multicast ttl     : 100
sep 30 16:07:12 IPTV tomcast[489]: Syslog disabled.
sep 30 16:07:12 IPTV tomcast[489]: Daemonize         : /var/run/tomcast.pid
sep 30 16:07:12 IPTV tomcast[489]: 1
sep 30 16:07:12 IPTV systemd[1]: Started LSB: Tomcast init script.
sep 30 16:08:17 IPTV systemd[1]: Started LSB: Tomcast init script.
sep 30 16:09:27 IPTV systemd[1]: Started LSB: Tomcast init script.



root@IPTV:/home/xxx# service tomcast restart
root@IPTV:/home/xxx# service tomcast status
● tomcast.service - LSB: Tomcast init script
  Loaded: loaded (/etc/init.d/tomcast)
  Active: active (running) since sáb 2017-09-30 16:09:39 CEST; 2s ago
 Process: 968 ExecStop=/etc/init.d/tomcast stop (code=exited, status=0/SUCCESS)
 Process: 973 ExecStart=/etc/init.d/tomcast start (code=exited, status=0/SUCCESS)
  CGroup: /system.slice/tomcast.service
          └─976 /usr/bin/tomcast -o 10.5.0.85 -b 10.5.0.84 -p 8081 -t 100 -d /var/run/tomcast.pid -c /etc/tomcast/channels.cfg

sep 30 16:09:39 IPTV tomcast[973]: Copyright (C) 2010-2016 Unix Solutions Ltd.
sep 30 16:09:39 IPTV tomcast[973]: Configuration:
sep 30 16:09:39 IPTV tomcast[973]: Server ident      : unixsol/tomcast
sep 30 16:09:39 IPTV tomcast[973]: Channels file     : /etc/tomcast/channels.cfg
sep 30 16:09:39 IPTV tomcast[973]: Output iface addr : 10.5.0.85
sep 30 16:09:39 IPTV tomcast[973]: Multicast ttl     : 100
sep 30 16:09:39 IPTV tomcast[973]: Syslog disabled.
sep 30 16:09:39 IPTV tomcast[973]: Daemonize         : /var/run/tomcast.pid
sep 30 16:09:39 IPTV tomcast[973]: Starting web srv  : http://10.5.0.84:8081/status (sock: 3)
sep 30 16:09:39 IPTV tomcast[973]: 0