el advenedizo no puede ejecutar el servicio y no puede depurar

el advenedizo no puede ejecutar el servicio y no puede depurar

estoy usandoos-svc-daemonpara crear mi servicio advenedizo para el proyecto openstack.

mi configuración de trabajo advenedizo es la siguiente

Archivo: /etc/init/myservice.conf

start on runlevel [2345]
stop on runlevel [016]


env OS_SVC_ENABLE_CONTROL=1
export OS_SVC_ENABLE_CONTROL

pre-start script
  mkdir -p /var/run/myservice
  chown -R root:root /var/run/myservice
end script

respawn
# the default post-start of 1 second sleep delays respawning enough to
# not hit the default of 10 times in 5 seconds. Make it 2 times in 5s.
respawn limit 2 5

exec start-stop-daemon --start -c root --exec /opt/stack/venvs/openstack/bin/myservice --

post-start exec sleep 1

Este servicio se ejecuta como usuario root.

Si corro, start-stop-daemon --start -c root --exec /opt/stack/venvs/openstack/bin/myserviceentonces funciona bien.

Pero cuando compruebo el estado usando

~# initctl start myservice
myservice stop/starting

~# initctl status myservice
myservice stop/waiting

yo también lo intentéDepuración

start on runlevel [2345]
stop on runlevel [016]


env OS_SVC_ENABLE_CONTROL=1
export OS_SVC_ENABLE_CONTROL

pre-start script      
  mkdir -p /var/run/myservice
  chown -R root:root /var/run/myservice
end script

script
  echo "DEBUG: `set`" >> /tmp/myjob.log

  # rest of script follows...
end script    

respawn
# the default post-start of 1 second sleep delays respawning enough to
# not hit the default of 10 times in 5 seconds. Make it 2 times in 5s.
respawn limit 2 5

exec start-stop-daemon --start -c root --exec /opt/stack/venvs/openstack/bin/myservice --

post-start exec sleep 1

Pero no se crea el archivo en/tmp

Respuesta1

Supongo que uno de los comandos en tuguión previo al inicioestá fallando (probablemente mkdir). Intente agregar "|| verdadero"

pre-start script      
  mkdir -p /var/run/myservice || true
  chown -R root:root /var/run/myservice || true
end script

Deberías ver unpidAparece después del initctl start myservicecomando.

información relacionada