via an interrupt signal (SIGINT), then the service should be considered started.
Note that if the interrupt was issued by Dinit to cancel startup, the service
will instead be considered stopped.
+.TP
+\fBsignal-process-only\fR
+Signal the service process only, rather than its entire process group, whenever
+sending it a signal for any reason.
.RE
.LP
The next section contains example service descriptions including some of the
void base_process_service::kill_pg(int signo) noexcept
{
- pid_t pgid = bp_sys::getpgid(pid);
- if (pgid == -1) {
- // only should happen if pid is invalid, which should never happen...
- log(loglevel_t::ERROR, get_name(), ": can't signal process: ", strerror(errno));
- return;
+ if (onstart_flags.signal_process_only) {
+ bp_sys::kill(pid, signo);
+ }
+ else {
+ pid_t pgid = bp_sys::getpgid(pid);
+ if (pgid == -1) {
+ // only should happen if pid is invalid, which should never happen...
+ log(loglevel_t::ERROR, get_name(), ": can't signal process: ", strerror(errno));
+ return;
+ }
+ bp_sys::kill(-pgid, signo);
}
- bp_sys::kill(-pgid, signo);
}
void base_process_service::timer_expired() noexcept
bool pass_cs_fd : 1; // pass this service a control socket connection via fd
bool start_interruptible : 1; // the startup of this service process is ok to interrupt with SIGINT
bool skippable : 1; // if interrupted the service is skipped (scripted services)
+ bool signal_process_only : 1; // signal the session process, not the whole group
- service_flags_t() noexcept : rw_ready(false), log_ready(false),
- no_sigterm(false), runs_on_console(false), starts_on_console(false),
- pass_cs_fd(false), start_interruptible(false), skippable(false)
+ service_flags_t() noexcept : rw_ready(false), log_ready(false), no_sigterm(false),
+ runs_on_console(false), starts_on_console(false), pass_cs_fd(false),
+ start_interruptible(false), skippable(false), signal_process_only(false)
{
}
};
else if (option_txt == "skippable") {
onstart_flags.skippable = true;
}
+ else if (option_txt == "signal-process-only") {
+ onstart_flags.signal_process_only = true;
+ }
else {
throw service_description_exc(name, "Unknown option: " + option_txt);
}