From nobody Wed Feb 14 21:54:33 2024 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TZsRm6bjSz53XST for ; Wed, 14 Feb 2024 21:54:44 +0000 (UTC) (envelope-from freebsd-hackers@dino.sk) Received: from cm0.netlabit.sk (mailhost.netlabit.sk [84.245.65.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4TZsRl3vzYz43wb for ; Wed, 14 Feb 2024 21:54:43 +0000 (UTC) (envelope-from freebsd-hackers@dino.sk) Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of freebsd-hackers@dino.sk designates 84.245.65.72 as permitted sender) smtp.mailfrom=freebsd-hackers@dino.sk Received: from zeta.dino.sk ([84.245.95.254]) (AUTH: LOGIN milan, TLS: TLSv1.3,256bits,TLS_AES_256_GCM_SHA384) by cm0.netlabit.sk with ESMTPSA id 0000000002B8D0F3.0000000065CD369B.0000F5E1; Wed, 14 Feb 2024 22:54:35 +0100 Date: Wed, 14 Feb 2024 22:54:33 +0100 From: Milan Obuch To: freebsd-hackers@freebsd.org Subject: Re: rcorder question Message-ID: <20240214225433.319d1c2d@zeta.dino.sk> In-Reply-To: References: <20240213121936.2c0fc4c0@zeta.dino.sk> X-Mailer: Claws Mail 3.20.0 (GTK+ 2.24.33; amd64-portbld-freebsd13.1) List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.27 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.97)[-0.966]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; RCVD_COUNT_ONE(0.00)[1]; ASN(0.00)[asn:5578, ipnet:84.245.64.0/18, country:SK]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org]; MID_RHS_MATCH_FROMTLD(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; R_DKIM_NA(0.00)[]; TO_DN_NONE(0.00)[]; DMARC_NA(0.00)[dino.sk]; TO_MATCH_ENVRCPT_ALL(0.00)[]; ARC_NA(0.00)[] X-Rspamd-Queue-Id: 4TZsRl3vzYz43wb On Tue, 13 Feb 2024 11:27:44 +0000 David Chisnall wrote: > A quick look at teh socat RC script suggests that it contains this > line: >=20 > # PROVIDE: socat >=20 > You should be able to simply add: >=20 > # REQUIRE: socat >=20 > And your service will start after socat. But to do that you need to > not use `rc.local` and instead provide a separate RC script. There > are some examples in the man page and the web site: >=20 > https://man.freebsd.org/cgi/man.cgi?query=3Drc >=20 > https://docs.freebsd.org/en/articles/rc-scripting/ >=20 > In general, I wouldn=E2=80=99t use rc.local for anything that has > dependencies outside of rc.local (or, in fact, for anything). If you > have a service that needs to be started after something else, then > put it in etc/rc.d and enable it via rc.conf (or, ideally, something > in rc.conf.d). If you want to move it to a different machine, you > now just need to copy the files across rather than extract bits of > config files (this also makes it easier to create packages for it, if > you wish to automate installation). =20 >=20 > David >=20 Thanks for pointer, I created simple script and it looks like it works as expected: --- 8< --------------------------------- #!/bin/sh # PROVIDE: scex # REQUIRE: socat . /etc/rc.subr name=3Dscex rcvar=3Dscex_enable=20 start_cmd=3D"${name}_start" stop_cmd=3D":" load_rc_config $name=20 : ${scex_enable:=3Dno}=20 scex_start() { /usr/local/bin/init_program /usr/local/bin/main_program /dev/cuaV0 & } run_rc_command "$1" --- 8< --------------------------------- For it to run, I added to /etc/rc.conf: scex_enable=3D"YES" There is no stop instruction, but it is just enough for my purpose at the moment. Is there anything which would be recommended to change? Regards, Milan