Eu tenho o script upstart como
description "My API API"
author "me@localhost"
env MY_API_PYTHON_HOME=/opt/services
start on runlevel [2345]
stop on runlevel [!2345]
script
mkfifo /tmp/my-api-log-fifo
( logger -t my-api </tmp/my-api-log-fifo & )
exec >/tmp/my-api-log-fifo
rm /tmp/my-api-log-fifo
exec $MY_API_PYTHON_HOME/script_api_virt/bin/python $MY_API_PYTHON_HOME/my_api.py 2>/dev/null
end script
# Restart the process if it dies with a signal
# or exit code not given by the 'normal exit' stanza.
respawn
# Give up if restart occurs 10 times in 90 seconds.
respawn limit 10 90
Quando eu habilito o log de depuração, sua exibição
Oct 3 19:50:48 localhost kernel: [6732712.553365] init: job_class_register: Registered job /com/ubuntu/Upstart/jobs/ureadahead
Oct 3 19:50:48 localhost kernel: [6732712.553692] init: my-api goal changed from start to stop
Oct 3 19:50:48 localhost kernel: [6732712.553742] init: my-api state changed from running to pre-stop
Oct 3 19:50:48 localhost kernel: [6732712.553776] init: my-api state changed from pre-stop to stopping
Oct 3 19:50:48 localhost kernel: [6732712.553808] init: event_new: Pending stopping event
Oct 3 19:50:48 localhost kernel: [6732712.553823] init: Handling stopping event
Oct 3 19:50:48 localhost kernel: [6732712.553889] init: event_finished: Finished stopping event
Oct 3 19:50:48 localhost kernel: [6732712.553895] init: my-api state changed from stopping to killed
Oct 3 19:50:48 localhost kernel: [6732712.553935] init: Sending TERM signal to my-api main process (25787)
Oct 3 19:50:48 localhost kernel: [6732712.556636] init: my-api main process (25787) killed by TERM signal
Oct 3 19:50:48 localhost kernel: [6732712.556689] init: my-api state changed from killed to post-stop
Oct 3 19:50:48 localhost kernel: [6732712.556735] init: my-api state changed from post-stop to waiting
Oct 3 19:50:48 localhost kernel: [6732712.556768] init: event_new: Pending stopped event
Oct 3 19:50:48 localhost kernel: [6732712.556783] init: job_change_state: Destroyed inactive instance my-api
Oct 3 19:50:48 localhost kernel: [6732712.556837] init: Handling stopped event
Upstart tem respawn
logic, e meu serviço é iniciado automaticamente, mas eu quero saber por que ele está parando com TERM
singal.
Como acompanhar quem está parando este serviço?
Quando executo o comando exec $MY_API_PYTHON_HOME/script_api_virt/bin/python $MY_API_PYTHON_HOME/my_api.py
, ele foi executado por 12 horas sem nenhum erro.