FS#22946 - [initscripts] internal: add killproc function

Attached to Project: Arch Linux
Opened by Thomas S Hatch (thatch45) - Friday, 18 February 2011, 04:44 GMT
Last edited by Tom Gundersen (tomegun) - Tuesday, 08 May 2012, 12:43 GMT
Task Type Feature Request
Category Arch Projects
Status Closed
Assigned To Thomas Bächler (brain0)
Roman Kyrylych (Romashka)
Tom Gundersen (tomegun)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

This never came up running Arch on my servers at home and on my laptop, but now that I am running thousands of virtual machines with miles of automation scripts murphy's law is rearing it's ugly head.

The problem I am running into is the fact that many Arch init scripts don't block until they are finished killing a process. So what happens is that restarts fail to start because the daemon has not always stopped before the start is called. Also, some automation systems (like puppet) don't always call restart, but sometimes call stop and then start.

My argument is that using a sleep call in an init script's restart call is non deterministic behavior and we can do better.

My proposal for a fix to this problem is to add a killproc function to the default functions, I have attached an idea for one, but think it is a subject worth discussing. Basically, it waits until the pid in question dies, but can stat a failure if the pid does not die, and can take an optional parameter to use a signal 9 if the normal signal 15 does not work.

This file and a little script to test it out are also available in my gihub:
https://github.com/thatch45/sandbox/tree/master/arch-rc
This task depends upon

Closed by  Tom Gundersen (tomegun)
Tuesday, 08 May 2012, 12:43 GMT
Reason for closing:  Deferred
Comment by Thomas Bächler (brain0) - Monday, 28 February 2011, 11:29 GMT
A quick glance tells me this looks reasonable.

Comments: Initscripts recently moved to use the bash [[ constructs in favor of the posix [, for coding style consistency, those should be used here, too.
Comment by Thomas S Hatch (thatch45) - Monday, 28 February 2011, 16:00 GMT
Thanks Thomas, I will prepare a patch with it and fix the coding style, I will look into some of the other init scripts bugs as well
Comment by Tom Gundersen (tomegun) - Thursday, 23 June 2011, 14:32 GMT
@thatch45: This looks like a very reasonable feature. If you are still interested in this, could you rebase your patch and post it to the arch projects ML?
Comment by Thomas S Hatch (thatch45) - Thursday, 23 June 2011, 15:02 GMT
Yes, I am interested, sorry, I have been falling behind in my Arch duties, life just got very crazy! I will get this in ASAP!
Comment by Tom Gundersen (tomegun) - Thursday, 23 June 2011, 15:16 GMT
Take your time, no worries :)
Comment by Tom Gundersen (tomegun) - Tuesday, 08 May 2012, 12:43 GMT
If anyone wants this feature, please post patches to arch-projects@archlinux.org, I probably will not have time to work on it myself.

Loading...