- Edited
@ eric I posted here because really, when I wrote this offline, I realized while writing/investigating that this was not going to be a discussion at all. Hence I just wanted to emphasize the typo.
Here's a bug for you though:
You have another typo in the nginx service frontend file which makes it error out:
Edit 1:
This goes further. I corrected the typo but your -g flag seems to be wrong. I personally never have used directives with nginx. The flag itself seems to be correct so I guess the whitespace is most probably not escaped well.
(The types_hash_max_size is to be ignored)
Also during further testing when I just remove the -g option from the frontend command the log file will not show the error anymore (as expected) but localhost will not be reachable. Manually starting nginx from the command line works as expected, also with -g "daemon off;". The [notice] signal process started looks wrong to me. There's no signal sent in the [start] command in the frontend file so why this notice?
Edit 3:
If I remove env from @ options and the whole env section and hard code the service like this it somehow works (despite the fact that the -g option is still not parsed right [as it still appears in log even though the service runs like this, the option is ignored]):
In contrast this does NOT work (!):
I can personally get it to work with bash like this:
(Meaning I can enable and start the service, reach the server and have no errors shown in log)
Also the -g "daemon off;" flag makes this an active foreground process. How is it then that when omitting this option in the frontend command the programm will constantly get called? (I can see this tapping like crazy on F5 while navigating to localhost) Shouldn't it just be fired once and then sent to background as it does from the command line?
Has this to do with the classic type? As in: classic will try to be constantly up and after firing the command without the -g "daemon off;" option the program closes and needs to be brought up again? Is that it?
Funnily though if I want to make it a oneshot service then I get all sorts of error messages about how my command is a missing directory...(please take note that I debug this by always re-enabling the service with 66-enable -FSC)
Here's a bug for you though:
You have another typo in the nginx service frontend file which makes it error out:
--- /etc/66/service/nginx 2020-01-09 03:44:42.000000000 +0100
+++ /etc/66/service/nginx.fix 2020-01-24 13:11:11.426414855 +0100
@ @ -12,7 +12,7 @ @
if -nt { s6-test -d ${dir_run} }
s6-mkdir -p -m0755 ${dir_run}
}
-execl-cmdline -s { nginx ${cms_args} -c ${conf_dir}/${conf_file} } )
+execl-cmdline -s { nginx ${cmd_args} -c ${conf_dir}/${conf_file} } )
[stop]
@ build = auto
And why was this installed in /etc/66/service rather than in /lib/66/service btw? Shouldn't there be only my own administrated custom services here?Edit 1:
This goes further. I corrected the typo but your -g flag seems to be wrong. I personally never have used directives with nginx. The flag itself seems to be correct so I guess the whitespace is most probably not escaped well.
(The types_hash_max_size is to be ignored)
@ 400000005e2ae1523797dc42 2020/01/24 13:21:01 [warn] 3413# 3413: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 64; ignoring types_hash_bucket_size
@ 400000005e2ae15237a0f456 2020/01/24 13:21:01 [notice] 3413# 3413: signal process started
@ 400000005e2ae15237a0f79f 2020/01/24 13:21:01 [error] 3413# 3413: open() "/run/nginx.pid" failed (2: No such file or directory)
@ 400000005e2ae15336b8ac5e nginx: invalid option: "off;""
Edit 2:Also during further testing when I just remove the -g option from the frontend command the log file will not show the error anymore (as expected) but localhost will not be reachable. Manually starting nginx from the command line works as expected, also with -g "daemon off;". The [notice] signal process started looks wrong to me. There's no signal sent in the [start] command in the frontend file so why this notice?
Edit 3:
If I remove env from @ options and the whole env section and hard code the service like this it somehow works (despite the fact that the -g option is still not parsed right [as it still appears in log even though the service runs like this, the option is ignored]):
[main]
@ type = classic
@ description = "nginx daemon"
@ user = ( root )
@ options = ( log )
[start]
@ build = auto
@ execute = (
foreground
{
if -nt { s6-test -d /run/nginx }
s6-mkdir -p -m0755 /run/nginx
}
nginx -g "daemon off;" -c /etc/nginx/nginx.conf )
[stop]
@ build = auto
@ execute = (
execl-cmdline -s { nginx -s stop } )
Edit 4:In contrast this does NOT work (!):
@ execute = (
...
execl-cmdline -s { nginx -g "daemon off;" -c /etc/nginx/nginx.conf } )
Edit 5:I can personally get it to work with bash like this:
(Meaning I can enable and start the service, reach the server and have no errors shown in log)
[start]
@ build = custom
@ shebang = "/bin/bash"
@ execute = (
if [ ! -d "/run/nginx" ]
then
mkdir -p -m0755 /run/nginx
fi
nginx -g "daemon off;" -c /etc/nginx/nginx.conf
)
[stop]
@ build = custom
@ shebang = "/bin/bash"
@ execute = (
nginx -s stop
)
Although I wonder why when issuing "66-disable -S ..." the [stop] command won't get forwarded. Because when I do "66-stop" it does. This means that when I 66-disable the server is still reachable.Also the -g "daemon off;" flag makes this an active foreground process. How is it then that when omitting this option in the frontend command the programm will constantly get called? (I can see this tapping like crazy on F5 while navigating to localhost) Shouldn't it just be fired once and then sent to background as it does from the command line?
Has this to do with the classic type? As in: classic will try to be constantly up and after firing the command without the -g "daemon off;" option the program closes and needs to be brought up again? Is that it?
Funnily though if I want to make it a oneshot service then I get all sorts of error messages about how my command is a missing directory...(please take note that I debug this by always re-enabling the service with 66-enable -FSC)