2013-01-10 15:20:01 +01:00
|
|
|
Index: systemd-195/src/core/service.c
|
2011-12-12 16:59:25 +01:00
|
|
|
===================================================================
|
2013-01-10 15:20:01 +01:00
|
|
|
--- systemd-195.orig/src/core/service.c
|
|
|
|
+++ systemd-195/src/core/service.c
|
|
|
|
@@ -146,6 +146,7 @@ static void service_init(Unit *u) {
|
2011-12-12 16:59:25 +01:00
|
|
|
#ifdef HAVE_SYSV_COMPAT
|
|
|
|
s->sysv_start_priority = -1;
|
|
|
|
s->sysv_start_priority_from_rcnd = -1;
|
|
|
|
+ s->sysv_remain_after_exit_heuristic = true;
|
|
|
|
#endif
|
|
|
|
s->socket_fd = -1;
|
|
|
|
s->guess_main_pid = true;
|
2013-01-10 15:20:01 +01:00
|
|
|
@@ -906,6 +907,34 @@ static int service_load_sysv_path(Servic
|
2012-05-26 13:00:31 +02:00
|
|
|
free(short_description);
|
|
|
|
short_description = d;
|
2011-12-12 16:59:25 +01:00
|
|
|
|
|
|
|
+ } else if (startswith_no_case(t, "PIDFile:")) {
|
|
|
|
+ char *fn;
|
|
|
|
+
|
|
|
|
+ state = LSB;
|
|
|
|
+
|
|
|
|
+ fn = strstrip(t+8);
|
|
|
|
+ if (!path_is_absolute(fn)) {
|
|
|
|
+ log_warning("[%s:%u] PID file not absolute. Ignoring.", path, line);
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!(fn = strdup(fn))) {
|
|
|
|
+ r = -ENOMEM;
|
|
|
|
+ goto finish;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ free(s->pid_file);
|
|
|
|
+ s->pid_file = fn;
|
|
|
|
+ s->sysv_remain_after_exit_heuristic = false;
|
2012-02-16 16:24:03 +01:00
|
|
|
+ s->remain_after_exit = false;
|
2011-12-12 16:59:25 +01:00
|
|
|
+ } else if (startswith_no_case(t, "X-Systemd-RemainAfterExit:")) {
|
|
|
|
+ char *j;
|
|
|
|
+
|
|
|
|
+ state = LSB;
|
2012-02-16 16:24:03 +01:00
|
|
|
+ if ((j = strstrip(t+26)) && *j) {
|
|
|
|
+ s->remain_after_exit = parse_boolean(j);
|
|
|
|
+ s->sysv_remain_after_exit_heuristic = false;
|
|
|
|
+ }
|
2012-05-26 13:00:31 +02:00
|
|
|
} else if (state == LSB_DESCRIPTION) {
|
|
|
|
|
|
|
|
if (startswith(l, "#\t") || startswith(l, "# ")) {
|
2013-01-10 15:20:01 +01:00
|
|
|
@@ -963,7 +992,8 @@ static int service_load_sysv_path(Servic
|
2012-02-16 16:24:03 +01:00
|
|
|
|
|
|
|
/* Special setting for all SysV services */
|
|
|
|
s->type = SERVICE_FORKING;
|
|
|
|
- s->remain_after_exit = !s->pid_file;
|
|
|
|
+ if (s->sysv_remain_after_exit_heuristic)
|
|
|
|
+ s->remain_after_exit = !s->pid_file;
|
|
|
|
s->guess_main_pid = false;
|
|
|
|
s->restart = SERVICE_RESTART_NO;
|
|
|
|
s->exec_context.ignore_sigpipe = false;
|
2013-01-10 15:20:01 +01:00
|
|
|
@@ -2138,7 +2168,7 @@ static void service_enter_running(Servic
|
2011-12-12 16:59:25 +01:00
|
|
|
if ((main_pid_ok > 0 || (main_pid_ok < 0 && cgroup_ok != 0)) &&
|
|
|
|
(s->bus_name_good || s->type != SERVICE_DBUS)) {
|
|
|
|
#ifdef HAVE_SYSV_COMPAT
|
|
|
|
- if (s->sysv_enabled && !s->pid_file)
|
|
|
|
+ if (s->sysv_enabled && !s->pid_file && s->sysv_remain_after_exit_heuristic)
|
|
|
|
s->remain_after_exit = false;
|
|
|
|
#endif
|
|
|
|
service_set_state(s, SERVICE_RUNNING);
|
2013-01-10 15:20:01 +01:00
|
|
|
Index: systemd-195/src/core/service.h
|
2011-12-12 16:59:25 +01:00
|
|
|
===================================================================
|
2013-01-10 15:20:01 +01:00
|
|
|
--- systemd-195.orig/src/core/service.h
|
|
|
|
+++ systemd-195/src/core/service.h
|
2012-11-02 17:30:32 +01:00
|
|
|
@@ -176,6 +176,7 @@ struct Service {
|
|
|
|
bool is_sysv:1;
|
2011-12-12 16:59:25 +01:00
|
|
|
bool sysv_has_lsb:1;
|
|
|
|
bool sysv_enabled:1;
|
|
|
|
+ bool sysv_remain_after_exit_heuristic:1;
|
|
|
|
int sysv_start_priority_from_rcnd;
|
|
|
|
int sysv_start_priority;
|
|
|
|
|