mirror of
https://github.com/troglobit/finit.git
synced 2026-10-09 16:50:59 +07:00
Fix issue with services suddenly converting to 'forking' type
When a service starts up the pidfile.so plugin automatically detects any
new pidfiles that show up in the system. If it finds a matching service
which does not have a custom configured pidfile, it auto-assigns the
detected pidfile to the service.
However, when the user later calls `initctl reload` to update the
running configuration set, Finit service_register() mistakenly will
set the service to forking since it now suddenly has a pidfile ...
The new style way of configuring a forking service is to set the
type:forking
option. The old compat way was to set `pid:!/path/to/pidfile`, so
in service_register() we must be very careful not to interpret the
registered pidfile as confiugred by the user -- i.e., check the pid
option.
Bug #313
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
+2
-1
@@ -1619,7 +1619,8 @@ int service_register(int type, char *cfg, struct rlimit rlimit[], char *file)
|
||||
if (pid && pid_file_parse(svc, pid))
|
||||
logit(LOG_WARNING, "%s: service has invalid 'pid:' config: %s", svc->name, pid);
|
||||
|
||||
if (svc->pidfile[0] == '!')
|
||||
/* only set forking based on pidfile if user supplied pid: option */
|
||||
if (pid && svc->pidfile[0] == '!')
|
||||
svc->forking = 1;
|
||||
|
||||
if (svc->restart_tmo == 0) {
|
||||
|
||||
Reference in New Issue
Block a user