1 |
On Tue, 18 Feb 2014 11:46:14 +0800 Mark David Dumlao wrote: |
2 |
> init scripts, in general, are ad-hoc, quirky, and incomplete |
3 |
> implementations of service supervision in bash. They're reliable so |
4 |
> long as the daemon can be relied on to advertise one or all of its |
5 |
> processes in a pid file. Thing is, there are way too many different |
6 |
> possible setups for services for that to be the case. In the average |
7 |
> case watching a PID file works. And since most people use "average |
8 |
> software", most people don't care. That's ok. |
9 |
> |
10 |
> Thing is an init isn't just for "most people". It's for "all people". |
11 |
> It should be reliable for all services. |
12 |
> |
13 |
> I used to use cherokee. Fast, light, awesome, and with a web admin. |
14 |
> The init script always failed me. /etc/init.d/cherokee stop was not a |
15 |
> guaranteed stop to all forked cherokee processes - the parent pid |
16 |
> dies, but some forked process or something, usually related to |
17 |
> rrdtool, doesn't. Or the parent does exit and erases the pid file but |
18 |
> it returns control immediately and its not yet done exiting. Something |
19 |
> like that or other. Point is, I've several times had to ps aux|grep |
20 |
> ... kill; zap; start - on production servers. |
21 |
> |
22 |
> Was it cherokee's fault? Maybe. But the init script should have told |
23 |
> me that. Or even better, the init script should have done its job and |
24 |
> terminted the processes. See, pid files are just a proxy, they don't |
25 |
> work for all services and all setups. Maybe a process crashes before |
26 |
> it kills its forks. Maybe the server has a restart feature that fails |
27 |
> to write the pid file because the init script created it as root but |
28 |
> the daemon relinquished privileges. Maybe there's a bug somewhere. |
29 |
> Maybe the pid file gets overwritten accidentally. Maybe the pid file |
30 |
> is stale because of a power failure. Point is you don't know until the |
31 |
> service restart which should "just take a sec" costs you maybe an hour |
32 |
> or two in billable time. |
33 |
> |
34 |
> With supervised cgroups that's not a problem. Because all process |
35 |
> forks are grouped together, it doesn't matter if there's a pid file or |
36 |
> not. When its kill time, the daemon and all forks and children go |
37 |
> down. Because they're dynamically created on start, they don't get |
38 |
> stale or point to the wrong process. Sounds to me like the right tool |
39 |
> for the job. |
40 |
|
41 |
I agree with you. But openrc has cgroups support now for each |
42 |
service started. Thus systemd is not the only solution solving |
43 |
problem you described above. |
44 |
|
45 |
Best regards, |
46 |
Andrew Savchenko |