And this works perfectly. I missed the -D option in backtick. :) Yeah, /opt was just an example.
Thanks! On Thu, Mar 3, 2016 at 2:09 AM, Laurent Bercot <[email protected]> wrote: > On 02/03/2016 23:52, Jan Olszak wrote: > >> #!/usr/bin/execlineb -P >> if -nt >> { >> backtick -n S6_LOG_ARGS >> { >> redirfd -r 0 /opt/s6logargs.opts s6-cat >> } >> import -u S6_LOG_ARGS s6-log T $S6_LOG_ARGS >> } >> s6-log T s1000000 n10 /var/log/syslogd >> > > That won't work for several reasons: > > * the if -nt will only return once s6-log returns. Since s6-log is a > long-lived program, that won't happen unless there's an error in the > s6-log invocation. Which is what is happening here. > > * execline is not like the shell: when you import S6_LOG_ARGS, it is > evaluated as just one word - it's not split. So your s6-log invocation > is given two arguments: T, and whatever is in S6_LOG_ARGS. Likely > s6-log cannot interpret the contents of your opts file as one single > argument, so it fails - and dies, and if returns, and you get the > fallback. > > * Even if s6-log succeeded, you'd have the "if" process hanging around, > and s6-log would be a child of if. That's not what you want: you always > want the process to execute into your chosen avatar of s6-log in the end. > > Try something like this: > > ----- > backtick -n -D "s1000000 n10 /var/log/syslogd" S6_LOG_ARGS > { > redirfd -r 0 /opt/s6logargs.opts s6-cat > } > import -u -s S6_LOG_ARGS # notice the -s, to split the args > s6-log T ${S6_LOG_ARGS} > ----- > > Also, traditionally, /opt is not a good place to store regular files, > even global ones - you'd use /etc or a subdirectory of /etc for that. > But that's your business. :) > > -- > Laurent > >
