if (t->sysv_start_priority < 0)
continue;
- if (s->sysv_has_lsb && t->sysv_has_lsb)
+ /* If both units have modern headers we don't care
+ * about the priorities */
+ if ((!s->sysv_path || s->sysv_has_lsb) &&
+ (!t->sysv_path || t->sysv_has_lsb))
continue;
if (t->sysv_start_priority < s->sysv_start_priority)
prefix, kill_mode_to_string(s->kill_mode),
prefix, service_type_to_string(s->type));
+ if (s->control_pid > 0)
+ fprintf(f,
+ "%sControl PID: %llu\n",
+ prefix, (unsigned long long) s->control_pid);
+
+ if (s->main_pid > 0)
+ fprintf(f,
+ "%sMain PID: %llu\n",
+ prefix, (unsigned long long) s->main_pid);
+
if (s->pid_file)
fprintf(f,
"%sPIDFile: %s\n",
if ((unsigned long) (pid_t) p != p)
return -ERANGE;
- s->main_pid = p;
+ if (kill((pid_t) p, 0) < 0 && errno != EPERM) {
+ log_warning("PID %llu read from file %s does not exist. Your service or init script might be broken.",
+ (unsigned long long) p, s->pid_file);
+ return -ESRCH;
+ }
+
+ if ((r = unit_watch_pid(UNIT(s), (pid_t) p)) < 0)
+ /* FIXME: we need to do something here */
+ return r;
+
+ s->main_pid = (pid_t) p;
s->main_pid_known = true;
return 0;