Subject: start-stop-daemon redirect process log to syslog/logger

From: Paweł Szafer <[email-masked]>
Date: Sun, 29 Nov 2020 09:05:44 +0100

Hi,
I have Node-Red running in Alpine with init script like this:

#!/sbin/openrc-run
> NODE_USER="root"
> EXEC="node-red"
> depend(){
>         need net
>         need mosquitto
>         need logger
> }
> start() {
>         ebegin "Starting Node RED"
>         start-stop-daemon --start -b -u "${NODE_USER}" --quiet --exec
> "${EXEC}"
>         eend $?
> }
> stop() {
>         ebegin "Stopping Node RED"
>         start-stop-daemon --stop --quiet --exec "${EXEC}"
>         eend $?
> }

Node red by default output logs to console.
start-stop-daemon has --stdout and --stdout-logger, but people on the
internet seem to prefer pipe to logger binary. "> /var/log/some.log 2>&1""
Is it an outdated method or which way is preferred?
I want to redirect logs in such a way that:
- file is /var/log/node-red.log or /var/log/node-red/log.log
- file is automatically rotated.

What would be the best way to achieve this?
Thanks for your help!

-----
Best regards,
Pawel