0

How can I send signals or events to a running Upstart job? I run a Node.js HTTP server with Upstart as a daemon and sometimes need to put it into maintenance mode for backups and stuff.

I'd like to send a signal to the node process, which then will response with the maintenance mode.

Can I do something like this? initctl sendsignal MyNodeDaemon maintenance

buschtoens
  • 169
  • 11

1 Answers1

0

Note currently, although we do plan to add such a feature. However, you can still do what you want using the status command. Something like:

pid=$(initctl status MyNodeDaemon | grep /running | awk '{print $NF}')
[ ! -z "$pid" ] && kill -SIGFOO $pid
jamesodhunt
  • 849
  • 5
  • 4
  • usually awk does not require a grep to filter the input since there is a built in functionality for this in awk – Istvan Jul 23 '12 at 16:35
  • If the daemon provides a CLI, would it be possible to send some CLI input to the daemon? – buschtoens Jul 27 '12 at 14:27
  • 1
    @jamesodhunt I see that it has been a year and a half since you wrote this. Is it still the case? I'd sure like to send SIGUSR1/2... – voxobscuro Feb 07 '14 at 17:09