Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) by nld3-dev1.alpinelinux.org (Postfix) with ESMTPS id 93D9B781901 for <~alpine/users@lists.alpinelinux.org>; Sun, 29 Nov 2020 08:05:57 +0000 (UTC) Received: by mail-lj1-f177.google.com with SMTP id y10so11887352ljc.7 for <~alpine/users@lists.alpinelinux.org>; Sun, 29 Nov 2020 00:05:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=+gjKPy7v7JF9KmS6ERwWOForgyfuwKcwgyNU9NUr2zU=; b=NlfwFI2KyP+2d4hFaKPcKoJGTIfjoOP1zMq6Z+Hvok7p5GvN5rnuDk7RSYIOD58vAb fzrnV2XJstKqy0VAeBcZJvf/OTzpZIS2yq8Bxjrvpf5TXjFY14cChFKRdq+nLbZbekWz 9mduhRcGGLS7PL3Oy567wLiDWkhjS4Bwjp/ZPAFftimwTqFwf6pSh05Cyzdn1Vl/umrv 9UqOszAUU6B5ry5fO88+PEG3PrSlKMpPGqZ/rXCzA/QMxjfMiTG3jwiFMqSEHVwk7b2W Cf0qrFLBEiB7dqHh3vV2AZXXF8V1Zi7MjDMc1lHCpiqpYpClLdJkIXev0WYnms2lgInY 14ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=+gjKPy7v7JF9KmS6ERwWOForgyfuwKcwgyNU9NUr2zU=; b=IzOwMhNA5GqsWR3p7akLHSdCI62G8iwhHP0c0xmkrBsGwrqNo0pjiiN46eWyr1O0FU Fhhz7e2L2d7tbYCvZ3a9DK4sTOBX3RGjb61WdUY2uyTwZZpPoKGorU6Z+d3q+4zEl3se vlPbCJK3E8kXWxNiqLCTLBvbDHuz5dgQiSpxP8VcuK0eB8UuBjBm4dAf5P311j0yuRM4 gy06bOLH2ND5a8hi8hk9dvqyGzrY1SHRR16yw44hdvmLdyyrkui9IHSkAZ7AL5m8WaN9 yzgFJ4Y793kcjZm0gjtlHVrvWsXkerB5XZZ3Ru7HRbKuFmZEuSd9/k8pF9BrrjIr2LBt 8MLQ== X-Gm-Message-State: AOAM53203HM+RUxFWHo7Kx5mpWVuFF8W+8+YC6RXThmGb+O2NRqiFSk0 5uK62UcK8OnCTpBufS/mjMqeo0+Hfk79ViT1voCfOtGJLFtFug== X-Google-Smtp-Source: ABdhPJzitb3HB7iA9ZmYvrBUsD9H33PrnA3TMpJR6jAK5Hd/St9zktNUZeOReLRb0EBehei05wrqVFh6pf2T3wgG71U= X-Received: by 2002:a2e:994:: with SMTP id 142mr6595487ljj.97.1606637155454; Sun, 29 Nov 2020 00:05:55 -0800 (PST) MIME-Version: 1.0 From: =?UTF-8?Q?Pawe=C5=82_Szafer?= Date: Sun, 29 Nov 2020 09:05:44 +0100 Message-ID: Subject: start-stop-daemon redirect process log to syslog/logger To: ~alpine/users@lists.alpinelinux.org Content-Type: multipart/alternative; boundary="000000000000ef129105b53a5c4c" --000000000000ef129105b53a5c4c Content-Type: text/plain; charset="UTF-8" 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 --000000000000ef129105b53a5c4c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,
I have Node-Red running in Alpine with init script= like this:

#!/sbin/openrc-run
NODE_USER=3D"root"
EXEC=3D"n= ode-red"
depend(){
=C2=A0 =C2=A0 =C2=A0 =C2=A0 need net
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 need mosquitto
=C2=A0 =C2=A0 =C2=A0 =C2=A0 need= logger
}
start() {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ebegin "Start= ing Node RED"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 start-stop-daemon --start= -b -u "${NODE_USER}" --quiet --exec "${EXEC}"
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 eend $?
}
stop() {
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 ebegin "Stopping Node RED"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = start-stop-daemon --stop --quiet --exec "${EXEC}"
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 eend $?
}

Node red by = default output logs to console.
start-stop-daemon has=C2=A0--stdo= ut and=C2=A0--stdout-logger, but people on the internet seem to prefer pipe= to logger binary. "> /var/log/some.log 2>&1""=C2= =A0=C2=A0
Is it an outdated method or which way is preferr= ed?
I want to redirect logs in such a way=C2=A0that:
- = 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=C2=A0your help!

-----
Best regards,
Pawel

=
--000000000000ef129105b53a5c4c--