Re: rc script for net/iperf3 daemon

2020-01-22 Thread Antoine Jacoutot
On Wed, Jan 22, 2020 at 11:33:21PM +0100, Jeremie Courreges-Anglas wrote:
> On Wed, Jan 22 2020, Klemens Nanni  wrote:
> > On Wed, Jan 22, 2020 at 09:39:16PM +0100, Alexander Bluhm wrote:
> >> For my performance tests it would be convenient to start an iperf3
> >> server as daemon automatically.  Can we add an rc script?
> > Seems reasonable.
> >
> >> Index: net/iperf3/pkg/iperf3.rc
> >> ===
> >> RCS file: net/iperf3/pkg/iperf3.rc
> >> diff -N net/iperf3/pkg/iperf3.rc
> >> --- /dev/null  1 Jan 1970 00:00:00 -
> >> +++ net/iperf3/pkg/iperf3.rc   22 Jan 2020 20:18:43 -
> >> @@ -0,0 +1,12 @@
> >> +#!/bin/ksh
> >> +#
> >> +# $OpenBSD$
> >> +
> >> +daemon="${TRUEPREFIX}/bin/iperf3"
> >> +daemon_flags="-s -D"
> > I think at least `-D' should be part of `$daemon', otherwise setting
> > flags only causes trouble.
> 
> +1, same for -s
> 
> > One might argue that `-s' for server mode belongs there as well, no?
> > Or to put it this way: does it make sense to specify `-c' for client
> > in flags?  Would one want to run a client service as well perhaps?
> 
> I think that's covered by -R.
> 
> ok jca@ with daemon="${TRUEPREFIX}/bin/iperf3 -s -D"
> 
> >> +daemon_user="_iperf3"
> >> +rc_reload=NO

Please put rc_reload after sourcing rc.subr.
See ports/infrastructure/templates/rc.template

-- 
Antoine



Re: rc script for net/iperf3 daemon

2020-01-22 Thread Jeremie Courreges-Anglas
On Wed, Jan 22 2020, Klemens Nanni  wrote:
> On Wed, Jan 22, 2020 at 09:39:16PM +0100, Alexander Bluhm wrote:
>> For my performance tests it would be convenient to start an iperf3
>> server as daemon automatically.  Can we add an rc script?
> Seems reasonable.
>
>> Index: net/iperf3/pkg/iperf3.rc
>> ===
>> RCS file: net/iperf3/pkg/iperf3.rc
>> diff -N net/iperf3/pkg/iperf3.rc
>> --- /dev/null1 Jan 1970 00:00:00 -
>> +++ net/iperf3/pkg/iperf3.rc 22 Jan 2020 20:18:43 -
>> @@ -0,0 +1,12 @@
>> +#!/bin/ksh
>> +#
>> +# $OpenBSD$
>> +
>> +daemon="${TRUEPREFIX}/bin/iperf3"
>> +daemon_flags="-s -D"
> I think at least `-D' should be part of `$daemon', otherwise setting
> flags only causes trouble.

+1, same for -s

> One might argue that `-s' for server mode belongs there as well, no?
> Or to put it this way: does it make sense to specify `-c' for client
> in flags?  Would one want to run a client service as well perhaps?

I think that's covered by -R.

ok jca@ with daemon="${TRUEPREFIX}/bin/iperf3 -s -D"

>> +daemon_user="_iperf3"
>> +rc_reload=NO
>> +
>> +. /etc/rc.d/rc.subr
>> +
>> +rc_cmd $1
>> 
>


-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



Re: rc script for net/iperf3 daemon

2020-01-22 Thread Klemens Nanni
On Wed, Jan 22, 2020 at 09:39:16PM +0100, Alexander Bluhm wrote:
> For my performance tests it would be convenient to start an iperf3
> server as daemon automatically.  Can we add an rc script?
Seems reasonable.

> Index: net/iperf3/pkg/iperf3.rc
> ===
> RCS file: net/iperf3/pkg/iperf3.rc
> diff -N net/iperf3/pkg/iperf3.rc
> --- /dev/null 1 Jan 1970 00:00:00 -
> +++ net/iperf3/pkg/iperf3.rc  22 Jan 2020 20:18:43 -
> @@ -0,0 +1,12 @@
> +#!/bin/ksh
> +#
> +# $OpenBSD$
> +
> +daemon="${TRUEPREFIX}/bin/iperf3"
> +daemon_flags="-s -D"
I think at least `-D' should be part of `$daemon', otherwise setting
flags only causes trouble.

One might argue that `-s' for server mode belongs there as well, no?
Or to put it this way: does it make sense to specify `-c' for client
in flags?  Would one want to run a client service as well perhaps?

> +daemon_user="_iperf3"
> +rc_reload=NO
> +
> +. /etc/rc.d/rc.subr
> +
> +rc_cmd $1
> 



rc script for net/iperf3 daemon

2020-01-22 Thread Alexander Bluhm
Hi,

For my performance tests it would be convenient to start an iperf3
server as daemon automatically.  Can we add an rc script?

ok?

bluhm

Index: infrastructure/db/user.list
===
RCS file: /data/mirror/openbsd/cvs/ports/infrastructure/db/user.list,v
retrieving revision 1.357
diff -u -p -r1.357 user.list
--- infrastructure/db/user.list 29 Nov 2019 02:42:44 -  1.357
+++ infrastructure/db/user.list 22 Jan 2020 20:31:48 -
@@ -354,3 +354,4 @@ id  usergroup   port
 844 _routinator_routinator net/routinator
 845 _snmpexporter  _snmpexporter   sysutils/snmp_exporter
 846 _dhcpcd_dhcpcd net/dhcpcd
+847 _iperf3_iperf3 net/iperf3
Index: net/iperf3/Makefile
===
RCS file: /data/mirror/openbsd/cvs/ports/net/iperf3/Makefile,v
retrieving revision 1.4
diff -u -p -r1.4 Makefile
--- net/iperf3/Makefile 28 Jun 2019 07:25:37 -  1.4
+++ net/iperf3/Makefile 22 Jan 2020 12:03:57 -
@@ -3,6 +3,7 @@
 COMMENT=   tool to measure maximum achievable bandwidth on IP networks

 V= 3.7
+REVISION=  0
 PKGNAME=   iperf3-${V}
 DISTNAME=  iperf-${V}

Index: net/iperf3/pkg/PLIST
===
RCS file: /data/mirror/openbsd/cvs/ports/net/iperf3/pkg/PLIST,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 PLIST
--- net/iperf3/pkg/PLIST21 Sep 2016 01:12:57 -  1.1.1.1
+++ net/iperf3/pkg/PLIST22 Jan 2020 20:32:36 -
@@ -1,7 +1,10 @@
 @comment $OpenBSD: PLIST,v 1.1.1.1 2016/09/21 01:12:57 lteo Exp $
+@newgroup _iperf3:847
+@newuser _iperf3:847:_iperf3:daemon:iperf3 server:/nonexistent:/sbin/nologin
+@rcscript ${RCDIR}/iperf3
 @bin bin/iperf3
 include/iperf_api.h
-lib/libiperf.a
+@static-lib lib/libiperf.a
 lib/libiperf.la
 @lib lib/libiperf.so.${LIBiperf_VERSION}
 @man man/man1/iperf3.1
Index: net/iperf3/pkg/iperf3.rc
===
RCS file: net/iperf3/pkg/iperf3.rc
diff -N net/iperf3/pkg/iperf3.rc
--- /dev/null   1 Jan 1970 00:00:00 -
+++ net/iperf3/pkg/iperf3.rc22 Jan 2020 20:18:43 -
@@ -0,0 +1,12 @@
+#!/bin/ksh
+#
+# $OpenBSD$
+
+daemon="${TRUEPREFIX}/bin/iperf3"
+daemon_flags="-s -D"
+daemon_user="_iperf3"
+rc_reload=NO
+
+. /etc/rc.d/rc.subr
+
+rc_cmd $1