If you are new to signals it can be useful to see how they can be used. When a process is created in a *nix like operating system it will have a PID - or process identifier that can be used to send signals to the process. For demonstration we will create an infinitely running process by tailing a file:
$ ps aux | grep tail
schneems 87152 0.0 0.0 2432772 492 s032 S+ 12:46PM 0:00.00 tail -f my.log
You can send a signal in Ruby using the :
Puma cluster responds to these signals:
TTIN
increment the worker count by 1TTOU
decrement the worker count by 1TERM
sendTERM
to worker. Worker will attempt to finish then exit.- restart workers. This also reloads puma configuration file, if there is one.
HUP
reopen log files defined in stdout_redirect configuration parameter. If there is no stdout_redirect option provided it will behave likeINT
INT
equivalent of sending Ctrl-C to cluster. Will attempt to finish then exit.CHLD
puma configuration file reloaded, if there is one
* Pruning Bundler environment
puma configuration file reloaded, if there is one
before_fork
on_worker_fork
after_worker_fork
on_worker_boot
Code of the app is loaded and running
on_worker_shutdown
on_worker_fork
after_worker_fork
Gemfile in context
on_worker_boot
Code of the app is loaded and running