summaryrefslogtreecommitdiff
path: root/src/service.c
AgeCommit message (Collapse)Author
2011-12-16service: use 'syslog+console' for sysv_consoleMichal Schmidt
The default output to 'tty' for SysV service was making it hard to debug problems because error messages were missing from syslog.
2011-12-03service: stop the service if ExecStartPost ends with a failureMichal Schmidt
The handling of failures in ExecStartPost is inconsistent. If the command times out, the service is stopped. But if the command exits with a failure, the service keeps running. It makes more sense to stop the service when ExecStartPost fails. If this behaviour is not desired, the ExecStartPost command can be prefixed with "-".
2011-12-03service: handle services with racy daemonization gracefullyMichal Schmidt
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-11-10service: don't warn if the pidfile still exists after SIGCHLDMichal Schmidt
A service that drops its privileges may not be able to remove it when it exits. The stale pidfile is not a problem as long as the service carefully recognizes it on its next start. systemd would produce a warning after the service exits: PID ... read from file ... does not exist. Your service or init script might be broken. Silence the warning in this case. Still warn if this error is detected when loading the pidfile after service start. Noticed by Miroslav Lichvar in https://bugzilla.redhat.com/show_bug.cgi?id=752396
2011-11-02Add Mageia supportDexter Morgan
This patch adds support for the Mageia Linux distribution: http://www.mageia.org/ Mageia is a fork of Mandriva although some divergence has already occured and thus inclusion of these changes upstream allow us to (hopefully) migrate more rapidly to the new standard approaches systemd offers. Indeed, we already use the preferred mechanism of OS identification via the /etc/os-release file rather than a distro specific variation. This patch mostly mirrors the patch added previously for Mandriva support. In addition to those original authors, this patch was mostly written by Dexter Morgan with help from Colin Guthrie and Eugeni Dodonov.
2011-10-17service: Drop rcN.d runlevels from SysV services that also exist in rcS.dTollef Fog Heen
Services which claim to start in both rcN.d and rcS.d generate loops which for some reason seems to usually end up with dbus not starting and the whole machine being quite unhappy. We now rather assume that if a service can be started in rcS, it should not also start in rcN.d. Fixes Debian bug #637037
2011-10-11service: don't try to guess PID for SysV services anymoreLennart Poettering
As it turns out there are quite a number of SysV services too broken to make the guessing work: instead of returning in the parent only after the child is fully initialized they return immediately. The effect is that the guessing in systemd might happen too early, at a time where the final main process doesn't exist yet. By turning this off we won't try to detect the main pid anymore, with the effect that all processes of the service in question are considered equally likely to be the main process.
2011-09-23service: fix up std output/error before we add dependencies to the bridge socketLennart Poettering
2011-09-23coverity: fix a couple of bugs found by coverityLennart Poettering
2011-09-22service: warn if a service fails to write its PID fileMichal Schmidt
Warn if a service promises to write a PID file (using 'PIDFile=' in the unit file or '# pidfile:' in SysV header), but fails to keep the promise. This warning will likely trigger also for the forking services with a racy daemonization, which exit the original process before the PID file is written.
2011-09-22service: if StandardInput=socket and StandardOutput=inherit imply socket for ↵Lennart Poettering
output, don't imply default output This is useful for inetd-style per-connection services, so that they again can simply specify StandardOutput=socket to connect all three fds to the socket.
2011-09-21service: minor change in service_load_pid_file return valueMichal Schmidt
Return 0 only if the PID was really loaded. If no PIDFile= is defined, return -ENOENT. Only one caller cares about the return value of this function and this change makes the usage nicer.
2011-09-21service: handle forking services that move to a new PIDMichal Schmidt
When some forking daemons receive a SIGHUP, they re-execute themselves and consequently change to a new main PID. As long as they update the PID file in the right order (before exiting the old PID), we can detect that and avoid killing them.
2011-09-20service: drop broken support for X-Interactive fields in LSB headersLennart Poettering
The logic never worked since reading from the boot console is useless when a service is started after boot. Hence drop this half-baked code, since we now have a place document incompatibilities like this. http://www.freedesktop.org/wiki/Software/systemd/Incompatibilities
2011-08-24service: all rcS.d scripts have been converted on FrugalwareMiklos Vajna
2011-08-20exec: optionally apply cgroup attributes to the cgroups we createLennart Poettering
2011-08-02service: parse insserv.conf and plugs its system facilities into systemd.Frederic Crozat
2011-08-01util: use join() instead of asprintf() as an optimizationLennart Poettering
2011-08-01util: various optimizations, using join()Lennart Poettering
2011-08-01load-fragment: speed up parsing by using a perfect hash table with ↵Lennart Poettering
configuration settings built by gperf
2011-07-13unit: use ESRCH as error when we don't find anybody to killLennart Poettering
2011-07-12service: properly handle who argument on D-Bus kill callsLennart Poettering
2011-07-06manager: merge serialization and desrialization counter into one, and ↵Lennart Poettering
increase it when reexecuting Instead of having individual counters n_serializing and n_deserializing have a single one n_reloading, which should be sufficient. Set n_reloading when we are about to go down for reexecution to avoid cgroup trimming when we free the units for reexecution.
2011-07-05service: 'pidfile:' in SysV chkconfig header implies a real daemonMichal Schmidt
The presence of the chkconfig "pidfile:" header in the initscript is an excellent indication that it's not a oneshot script (like iptables), but a real daemon (like httpd).
2011-07-01manager: don't even think of enumerating sysv services in user instancesLennart Poettering
2011-06-21service: check whether sysv scripts where changedLennart Poettering
2011-06-21dbus: introduce UnsetAndSetEnvironment()Lennart Poettering
2011-06-21english: s/_per_/_by_/Lennart Poettering
2011-05-18exec: hangup/reset/deallocate VTs in gettysLennart Poettering
Explicitly disconnect all clients from a VT when a getty starts/finishes (requires TIOCVHANGUP, available in 2.6.29). Explicitly deallocate getty VTs in order to flush scrollback buffer. Explicitly reset terminals to a defined state before spawning getty.
2011-05-09build-sys: Angstrom supportKoen Kooi
This commit consists of the initial work to include Angstrom as a ported distribution for systemd. Angstrom tries to follow the debian way as much as possible, but deviates where it doesn't make sense for 'embedded'.
2011-04-28service: properly notice when services with a main process that isn't a ↵Lennart Poettering
child of init die https://bugzilla.redhat.com/show_bug.cgi?id=699114
2011-04-20cgroup: don't accidentaly trim on reloadLennart Poettering
https://bugzilla.redhat.com/show_bug.cgi?id=678555
2011-04-06units: rename rtc-set.target to time-sync.target and pull it in by ↵Lennart Poettering
hwclock-load.service On request of Miroslav Lichvar, rename rtc-set.target to time-sync.target since usually the RTC chip isn't involved at all in NTP syncs. Also, pull it in by hwclock-load.service.
2011-04-06service: fix units with more than one socketLennart Poettering
https://bugzilla.redhat.com/show_bug.cgi?id=693289
2011-03-31src: our lord is coverityLennart Poettering
2011-03-30unit: never apply /etc/rcN.d/ priority to native servicesLennart Poettering
2011-03-29exec: drop process group kill mode since it has little use and confuses the userLennart Poettering
2011-03-18service: pull in sysv facility targets from the sysv units, not the other ↵Lennart Poettering
way round For an explanation see: http://lists.freedesktop.org/archives/systemd-devel/2011-March/001692.html
2011-03-18special: get rid of dbus.targetLennart Poettering
2011-03-17def: centralize definition of default timeout in one placeLennart Poettering
2011-03-14core: move abstract namespace sockets to /dev/.runLennart Poettering
Now that we have /dev/.run there's no need to use abstract namespace sockets. So, let's move things to /dev/.run, to make things more easily discoverable and improve compat with chroot() and fs namespacing.
2011-03-08build-sys: add Mandriva distribution supportsystemd/v20Andrey Borzenkov
This merges several separate patches that I carry as part of Mandriva systemd RPM. They touch those parts that are very unlikely to be changed in near future and do not impose any functionality change for systemd core. I also think it is useful for troubleshooting to have real distribution name in system logs, espicially when someone reports problem upstream. The patch looks bigger than sum of replaced patches because - previous patches were applied on top of distro=fedora, now I need to add all those bits for distro=mandriva as well - part of patch was done as spec file magic, but it seems more logical to ship all these bits together
2011-03-08service: use uppercase SYSV prefix to make it easier to recognizeLennart Poettering
2011-03-08service: prefix description with LSB only if script has LSB header, use ↵Lennart Poettering
'SysV:' otherwise
2011-03-06service: drop redundant check in sysv_translate_facilityLennart Poettering
We check for _r with an assert in the function header anyway, no need to check it again.
2011-03-03kill: always send SIGCONT after SIGTERMLennart Poettering
When we kill a process to terminate it make sure to send SIGCONT to ensure it is unpaused and processes the signal.
2011-02-28Spelling CorrectionsHarald Hoyer
Just some lame spelling corrections with no functionality.
2011-02-25service: never clean up a service that still has a process in itLennart Poettering
2011-02-15exec: introduce global defaults for the standard output of servicesLennart Poettering
2011-02-13service: make main pid guessing optional, and reread pid file after reloadsLennart Poettering