Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Feb 2024 12:19:37 +0100
From:      Milan Obuch <freebsd-hackers@dino.sk>
To:        freebsd-hackers@freebsd.org
Subject:   rcorder question
Message-ID:  <20240213121936.2c0fc4c0@zeta.dino.sk>

next in thread | raw e-mail | index | archive | help
Hi,

I am trying to solve an issue how to start local scripts in proper
order (for my application). Basically, I use net/socat port to create
virtual serial port used to read data from some device (just simple
character stream, with CR LF terminating the record with fixed position
items).

I configured socat instance in /etc/rc.conf:

socat_enable="YES"

and /usr/local/etc/socat-instances.conf:

[moxa]
daemonuser=root
flags="PTY,link=/dev/cuaV0,rawer,wait-slave TCP4:192.168.x.y:5000"

It works - on boot, designated device is contacted and virtual serial
port is created.

For starting program consuming data, I put following in /etc/rc.local:

/usr/local/xxx/yyy/zzz /dev/cuaV0 &

If started manually after boot up, it works as intended, but here is
the problem, it is started before socat, because

# rcorder /etc/rc.d/* /usr/local/etc/rc.d/* | grep local
/etc/rc.d/mountcritlocal
/usr/local/etc/rc.d/dbus
/etc/rc.d/local
/usr/local/etc/rc.d/socat

(some more entries edited out, not relevant to the issue).

So the question is how could I alter boot order to start /etc/rc.local
*after* socat instance. I tried, altering /etc/rc.d/local line (naively)

# REQUIRE: DAEMON

to

# REQUIRE: DAEMON socat

but this does not work, because then rcorder reports

rcorder: Circular dependency on file `/usr/local/etc/rc.d/socat'.
rcorder: Circular dependency on provision `LOGIN': /etc/rc.d/LOGIN -> /etc/rc.d/local -> /usr/local/etc/rc.d/socat -> /etc/rc.d/LOGIN.
rcorder: `/usr/local/etc/rc.d/socat' was seen in circular dependencies for 1 times.
rcorder: `/etc/rc.d/local' was seen in circular dependencies for 1 times.
rcorder: `/etc/rc.d/LOGIN' was seen in circular dependencies for 1 times.
rcorder: `/usr/local/etc/rc.d/socat' was seen in circular dependencies for 1 times.

I did some more, but no success yet... Anybody to offer some hint I can
try?

Regards,
Milan



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20240213121936.2c0fc4c0>