onstart = ...
depends-on = (service name)
waits-for = (service name)
+termsignal = HUP | INT | QUIT | USR1 | USR2
command = (external script or executable and arguments)
For a 'process' service, this is the process to run.
starting (or to fail starting) before commencing the start procedure
for this service. Starting this service will automatically start
the named service.
+
+termsignal = (signal)
+ Specifies an additional signal to send to the process when requesting it
+ to terminate (applies to 'process' services only). SIGTERM is always
+ sent along with the specified signal, unless the 'nosigterm' setting is
+ set true.
+
+nosigterm = yes | true | no | false
+ If true, the TERM signal will not be sent to the process to kill it. (If
+ an alternate signal is specified using the "termsignal" setting, that
+ signal will be sent instead; otherwise, no signal will be sent, and the
+ process must be killed by external means).
term_signal = signo;
}
}
+ else if (setting == "nosigterm") {
+ string sigtermsetting = read_setting_value(i, end);
+ onstart_flags.no_sigterm = (sigtermsetting == "yes" || sigtermsetting == "true");
+ }
else {
throw ServiceDescriptionExc(name, "Unknown setting: " + setting);
}
{
if (service_type == ServiceType::PROCESS) {
if (pid != -1) {
- // The process is still kicking on - must actually kill it.
- kill(pid, SIGTERM);
- if (term_signal != -1) {
- kill(pid, term_signal);
- }
- // Now we wait; the rest is done in process_child_callback
+ // The process is still kicking on - must actually kill it.
+ if (! onstart_flags.no_sigterm) {
+ kill(pid, SIGTERM);
+ }
+ if (term_signal != -1) {
+ kill(pid, term_signal);
+ }
+ // Now we wait; the rest is done in process_child_callback
}
else {
// The process is already dead.
bool release_console : 1;
bool rw_ready : 1;
- OnstartFlags() noexcept : release_console(false), rw_ready(false)
+ // Not actually "onstart" commands:
+ bool no_sigterm : 1; // do not send SIGTERM
+
+ OnstartFlags() noexcept : release_console(false), rw_ready(false), no_sigterm(false)
{
}
};