Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send reload command to upstart service

Tags:

ubuntu

upstart

How can I send some kind of reload command to a daemon started by upstart without the need to completely stop it?

like image 294
buschtoens Avatar asked May 29 '12 00:05

buschtoens


1 Answers

upstart typically manages two types of processes:

  • programs that run once to handle an event
  • daemons that are long-lived and provide a service to something else

Daemons typically provide a signal handler for the SIGHUP signal the ask the daemon to re-read and re-parse their configuration files. (SIGHUP is a hang-up signal, more relevant to terminals that may come and go as telephone lines or SSH protocols are connected or disconnected. For programs that do not have terminals, it doesn't make sense to "hang up" their terminal, so the signal wouldn't be sent to daemon except by system administrator action.)

If you can modify your program to re-read its configuration when it receives a SIGHUP signal, then you can use the standard upstart reload service command to reload the configuration files. (You can do anything on this signal, but system administrators expect daemons to re-read configuration files on this signal -- doing something else may be confusing and annoying.)

like image 138
sarnold Avatar answered Oct 16 '22 00:10

sarnold