diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2019-05-17 20:33:19 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2019-05-17 20:33:19 +0300 |
commit | c63b903713b6ec5600b11d6197c5c0c11f3b0247 (patch) | |
tree | 64d3195506272890e1d60a96a3d4e119fbfdec8d | |
parent | a3240e8cdde7d311cf006217d894a00398d4f130 (diff) | |
download | pies-c63b903713b6ec5600b11d6197c5c0c11f3b0247.tar.gz pies-c63b903713b6ec5600b11d6197c5c0c11f3b0247.tar.bz2 |
Provide an option to disable SysV init mode.
This is useful if pies is run as a entrypoint process in a
docker container.
-rw-r--r-- | src/cmdline.opt | 6 | ||||
-rw-r--r-- | src/pies.c | 9 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/cmdline.opt b/src/cmdline.opt index 5380b80..57f5b90 100644 --- a/src/cmdline.opt +++ b/src/cmdline.opt @@ -52,12 +52,18 @@ OPTION(foreground,,, [<remain in foreground>]) BEGIN log_to_stderr_only = 1; foreground = 1; END +OPTION(no-init,,, + [<don't suppose SysV init mode if PID is 1>]) +BEGIN + /* handled separately */ +END + OPTION(inetd,i,, [<run in inetd mode>]) BEGIN if (!instance) instance = "inetd"; current_syntax = &config_syntax_tab[CONF_INETD]; @@ -2029,12 +2029,13 @@ int main (int argc, char **argv) { pid_t pid; extern char **environ; struct grecs_list_entry *ep; int diag_flags; + int i; set_program_name (argv[0]); #ifdef ENABLE_NLS setlocale (LC_ALL, ""); bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); @@ -2046,12 +2047,20 @@ main (int argc, char **argv) pies_master_argc = argc; pies_master_argv = argv; set_quoting_style (NULL, shell_quoting_style); init_process = getpid () == 1; + for (i = 1; i < argc; i++) + { + if (strcmp (argv[i], "--no-init") == 0) + { + init_process = 0; + break; + } + } /* Set default logging */ if (init_process) { log_facility = LOG_DAEMON; diag_flags = DIAG_TO_STDERR | DIAG_REOPEN_LOG; |