On Sun, May 10 2020, Stuart Henderson <[email protected]> wrote:
> On 2020/05/10 12:58, Tom Smyth wrote:
>> Hello, porters
>>
>> I was working on fastnetmon on production system
>> rcctl starts stops and restarts fastnetmon just fine
>> but I noticed when I rebooted the box
>> that if I reboot the box fastnetmon wont restart due to a missing
>> .var/run/fastnetmon directory.
>>
>> when I re-create the directory
>> mkdir /var/run/fastnemon
>> chown _fastnetmon /var/run/fastnetmon
>>
>> rcctl starts, stops and restarts fastnetmon just fine once that
>> directory is re-created and the permissions set...
>>
>> --
>> Kindest regards,
>> Tom Smyth.
>>
>
> +cc ${MAINTAINER}
Done :)
> The rc script should be changed to do that (and drop the PLIST entry).
Same diff, except I used
install -m 750 -o _fastnetmon -g _fastnetmon
The reason for choosing group _fastnetmon and mode 750 is:
russell /usr/ports/net/fastnetmon$ doas ls -l /var/run/fastnetmon/
total 4
-rw-rw-rw- 1 _fastnetmon _fastnetmon 6 May 10 15:33 fastnetmon.pid
Anyone can write to the pid file. If /var/run/fastnetmon contents
should be shared with other local users then some kind of fix is needed.
[...]
> Index: pkg/fastnetmon.rc
> ===================================================================
> RCS file: /cvs/ports/net/fastnetmon/pkg/fastnetmon.rc,v
> retrieving revision 1.2
> diff -u -p -r1.2 fastnetmon.rc
> --- pkg/fastnetmon.rc 11 Jul 2018 15:24:56 -0000 1.2
> +++ pkg/fastnetmon.rc 10 May 2020 13:08:14 -0000
> @@ -7,4 +7,8 @@ daemon_user="_fastnetmon"
>
> . /etc/rc.d/rc.subr
>
> +rc_pre() {
> + install -d -o ${daemon_user} /var/run/fastnetmon
> +}
> +
> rc_cmd $1
>
>
--
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE