1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-07 09:56:51 +03:00
Commit Graph

27 Commits

Author SHA1 Message Date
Michal Schmidt
3a11183858 service: handle services with racy daemonization gracefully
There are a lot of forking daemons that do not exactly follow the
initialization steps as described in daemon(7). It is common that they
do not bother waiting in the parent process for the child to write the
PID file before exiting. The daemons' developers often do not perceive
this as a bug and they're unwilling to change.

Currently systemd warns about the missing PID file and falls back to
guessing the main PID. Being not quite deterministic, the guess can be
wrong with bad consequences. If the guessing is disabled, determinism is
achieved at the cost of losing the ability of noticing when the main
process of the service dies.

As long as it does not negatively affect properly written services,
systemd should strive for compatibility even with services with racy
daemonization. It is possible to provide determinism _and_ main process
supervision to them.

If the PID file is not there, rather than guessing and considering the
service running immediately after getting the SIGCHLD from the ExecStart
(or ExecStartPost) process, we can keep the service in the activating
state for a bit longer. We can use inotify to wait for the PID file to
appear. Only when it finally does appear and we read a valid PID from
it, we'll move the service to the running state. If the PID file never
appears, the usual timeout kicks in and the service fails.
2011-12-03 21:50:27 +01:00
Lennart Poettering
5f4b19f4bc service: check whether sysv scripts where changed 2011-06-21 19:29:45 +02:00
Lennart Poettering
6dfa54942c service: properly notice when services with a main process that isn't a child of init die
https://bugzilla.redhat.com/show_bug.cgi?id=699114
2011-04-28 04:56:55 +02:00
Lennart Poettering
ea87ca5a9e unit: never apply /etc/rcN.d/ priority to native services 2011-03-30 00:43:16 +02:00
Lennart Poettering
3185a36b05 service: make main pid guessing optional, and reread pid file after reloads 2011-02-13 18:51:30 +01:00
Lennart Poettering
867b3b7d6b service: make chain of main commands and control commands independent of each other, so that both can be executed simultaneously and independently 2011-01-20 18:46:38 +01:00
Lennart Poettering
e2f3b44cfc service: when reloading a service fails don't fail the entire service but just the reload job 2011-01-20 13:17:22 +01:00
Lennart Poettering
ba035df230 execute: make sending of SIGKILL on shutdown optional 2011-01-18 22:55:54 +01:00
Lennart Poettering
9fff8a1f16 mount: hook in q fsck@.service instance for all mount points with passno > 0 2010-10-13 03:57:04 +02:00
Lennart Poettering
50caaedb2c service: introduce Restart=on-failure and Restart=on-abort 2010-10-08 18:34:54 +02:00
Lennart Poettering
525ee6f4a1 service: rename settings for Restart= from 'restart-always' to 'always' and similar 2010-10-05 20:30:44 +02:00
Lennart Poettering
f976f3f67c socket: make sockets to pass to a service configurable 2010-10-05 19:50:00 +02:00
Fabiano Fidencio
07459bb6b9 sysv: optionally disable of SysV init/rcN.d support at compile time
This patch adds a cpp definition HAVE_SYSV_COMPAT that is used to
isolate code dealing with /etc/init.d and /etc/rcN.d for systems where
it does not make sense (one that does not use sysv or one that is fully
systemd native).

The patch tries to be as little intrusive as possible, however in
order to minimize the number of #ifdef'ed regions I've reordered some
code in path-lookup.c:lookup_paths_init() where all code dealing with
sysv is now isolated under running_as == MANAGER_SYSTEM as well.

Moreover, In struct Service, some fields were rearranged to reduce
the number of ifdefs.

Lennart's suggestions were fixed and squashed with the original patch,
that was sent by Gustavo Sverzut Barbieri (barbieri@profusion.mobi).
2010-09-27 03:25:05 +02:00
Matthew Miller
fdf20a3160 manager: add missing second part of s/maintenance/failed/ 2010-08-31 00:23:34 +02:00
Lennart Poettering
02ee865a46 service: rename ValidNoProcess= to RemainAfterExit= 2010-08-17 19:37:36 +02:00
Lennart Poettering
03467c88fb emacs: disable tabs in .h files, too 2010-08-17 03:50:18 +02:00
Lennart Poettering
34e9ba669e service: rename Type=finish to Type=oneshot and allow multiple ExecStart= lines for oneshot services
In contrast to the other service types oneshot services are usually not
long lasting and there's not necessarily a single clean main process for
them. This change allows multiple ExecStart= lines for this type of
services so that the admin/developer doesn't have to arbitrarily pick on
of various sequential commands as the "main one".
2010-08-13 18:23:01 +02:00
Lennart Poettering
47342320a0 main: fix auto restarting of units after a configuration reload 2010-08-09 23:53:49 +02:00
Lennart Poettering
5de6b30219 service: properly remember if a sysv is actually enabled
Previously we checked the SysV priority value to figure out if a SysV
unit was enabled or not, since th value was mostly read from the S
startup links. Since we read this value from the LSB headers as a
fallback we hence ended up considering a lot more services enabled than
were actually enabled.

This patch adds an explicit boolean which encodes whether a sysv service
is enabled or not via S links.

https://bugzilla.redhat.com/show_bug.cgi?id=615293
2010-08-09 17:12:25 +02:00
Lennart Poettering
8fe914ec81 device: do not merge devices
Don't try to merge devices that have been created via dependencies when
they appear in the system and can be recognized as the same.  Instead,
simply continue to maintain them independently of each other, however
with the same state cycle. Why? Because otherwise we'd have a hard time
to seperate the dependencies after the devices are unplugged again and
we hence cannot be sure anymore that next time the device is plugged in
it will carry the same names.

Example: if one depndency refers to dev-sda.device and another one to
dev-by-id-xxxyyy.device we only learn at time of plug in of the device
that it is actually the same device that was ment. In the moment the
device is unplugged again we won't know anymore their relation to each
other and the next time the harddisk is plugged it might even appear as
dev-by-id-xxxyyy.device and dev-sdb.service. To ensure the dependencies
continue to have the meaning they were intended to have let's hence keep
the .device objects seperate all the time, even when they are plugged
in.

This patch also introduces a new Following= property which points from
the various .device units of a specific device to the main .device unit
for it. This can be used by the client side to figure out the relation
of the .device units to each other and even filter units from display.
2010-07-20 20:33:24 +02:00
Lennart Poettering
2e22afe909 execute: add ability to configure the kill signal 2010-07-10 04:49:37 +02:00
Lennart Poettering
6cf6bbc268 socket: enforce limit on number of concurrent connections 2010-06-19 04:25:34 +02:00
Lennart Poettering
c952c6ece2 service: add minimal access control logic for notifcation socket 2010-06-18 23:12:48 +02:00
Lennart Poettering
18c78fb1af typo: the correct spelling is maintenance not maintainance 2010-06-16 14:01:55 +02:00
Lennart Poettering
8c47c7325f notify: add minimal readiness/status protocol for spawned daemons 2010-06-16 05:10:31 +02:00
Lennart Poettering
1f48cf56cb service: change default service type to 'simple' since that is the future 2010-06-02 19:17:23 +02:00
Lennart Poettering
e99e38bbdc build-sys: move source files to subdirectory 2010-05-16 18:45:24 +02:00