~alpine/users

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

Paweł Szafer <pszafer@gmail.com>
Details
Message ID
<CAJrMv72hGWnUmARtH+SrSYe-qi4KN-Wv1J8KWcNGBe7wMNNXAQ@mail.gmail.com>
DKIM signature
missing
Download raw message
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
Reply to thread Export thread (mbox)