On 2025-12-17, Micha. Markowski <[email protected]> wrote:
> czw., 23 pa§ 2025 o 16:18 Micha. Markowski <[email protected]>
> napisa.(a):
>>
>> It looks like the new lldpd(8) daemon doesn't have a corresponding rc
>> script in /etc/rc.d (checked on 7.8/amd64).
>> Is this intentional, or just an oversight?
On 2025-12-18 14:14:14, Stuart wrote:
> iirc this is intentional
>
> pkg_add doesn't have a good way to deal with an rc script moving from a
> package to base.
The easy solution (and best) is just add a line to rc.local.
lldpd
I can understand wanting to treat lldpd like other openbsd services
which thus require a rc.d script.
So as a *local administrator* wanting to create a new service:
You can copy one of the other scripts (ex: ldpd) and edit the daemon line.
I'm not sure if lldpd needs a "rc_reload=NO" line or not.
or
I just use a super generic rc.d script for stuff like this:
#!/bin/ksh
daemon="$(whence -p $(command -pv ${0##*/}))"
. /etc/rc.d/rc.subr
rc_cmd $1
Obviously the script needs to be named "lldpd" to work.
And hard links can be made for other generic services.
But since we (local admin) are making a new service,
add a new line to rc.conf.local
lldpd_flags=
You still nee a way to start the service during boot.
Without editing /etc/rc it's easiest to then just append "lldpd"
to the "pkg_scripts=" line in rc.conf.local.
Before you complain about my daemon= line, I agree it is better
to make a copy of the script and put the full-path-to-the-daemon
in there!
I wanted a generic way to find the path to the daemon that would
not be influenced by the caller's PATH. (safety, consistency)
"command -pv" uses a system default PATH for searching but will also
output builtin, aliases, functions.
I then use "whence -p" to verify the path or search caller's PATH
in the case of the daemon name matching a builtin shell command.
This filters out any alias or function being returned by "command -v".
Not perfect but safer then using either whence or command alone.
Also wanted to stick with shell commands and not run external executables
(ex: getconf PATH)
Definitely don't want to be setting PATH in the script.
Again it's just easier to copy the script and edit the daemon= line
or better yet jsut add lldpd to rc.local.