essentialkaos / anicorn

Simple utility for starting/restarting Unicorn
https://kaos.sh/anicorn
Apache License 2.0
1 stars 0 forks source link

Remove stale PID if process is dead to prevent failure during on Unicorn restarting #18

Closed gongled closed 6 years ago

gongled commented 6 years ago

What did you implement:

In case Unicorn process has been stopped with SIGKILL signal and PID file is exists, anicorn tries to restart Unicorn and, unsurprisingly, exits with an error. I suggest adding an extra check of PID file existence and remove it if process is dead.

How did you implement it:

I added one more condition to checkPIDFile function to remove stale PID file.

How can we verify it:

  1. Finish Unicorn process with SIGKILL signal.
  2. Make sure that PID file exists.
  3. Run anicorn.

It should successfully start the new Unicorn process.

Is this ready for review?: Yes Is it a breaking change?: No

andyone commented 6 years ago

Nice work, thank you!

gongled commented 6 years ago

Yes, I had thought about it literally a moment ago. Fixed (d2aafee).

andyone commented 6 years ago

@gongled Thanks for your contribution!