- Edited
Just a curiosity I came about looking at the nginx service file available in repos:
At least in the case of mysql that would throw errors.
No bug here or anything, just a comment out of curiosity.
Side Note:
Also s6-chown doesn't work with names, only IDs?
I did a very similar mysqld service and it works as expected with just basic instructions:
@ execute = (
foreground
{
if
{
if -nt { s6-test -d /run/nginx }
s6-mkdir -p -m0755 /run/nginx
}
s6-chown -u nginx -g nginx /run/nginx
}
execl-cmdline -s { nginx ${CMD_ARGS} } )
Why do you chose foreground here? Skarnet says:
soo,...in this case nginx would get fired even though the run directory didn't exist or had wrong owner/group? I don't know specifically for nginx yet but I'm looking into a similar case for mysqld and it seems to be the same regarding the requirements for the daemon. So even if the test blocks failed for whatever reason then the execl-cmdline would still get executed.[...] an execline script that must run prog3... no matter the result of the test, use a foreground wrapper:
foreground { if { prog1... } prog2... } prog3...
At least in the case of mysql that would throw errors.
No bug here or anything, just a comment out of curiosity.
Side Note:
Also s6-chown doesn't work with names, only IDs?
root@ obarun / # s6-chown -u mysql -g mysql /run/mysqld
s6-chown: usage: s6-chown [ -U ] [ -u uid ] [ -g gid ] file
Follow Up:I did a very similar mysqld service and it works as expected with just basic instructions:
@ execute = (
if {
if { mkdir -p /run/mysqld }
chown -R mysql:mysql /run/mysqld
}
execl-cmdline -s { mysqld_safe ${CMD_ARGS} } )
[environment]
!CMD_ARGS=--user=mysql --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --log-error=/var/log/mysql/error.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock --port=3306
P.S.: Maybe you could add this as mysqld-66serv to the repos since it's missing.