Is there any way to write PID file to /var/run or so with knot-resolver? I can't find any info in documentation about it.
We don't use PID files ourselves. I see those as a (poor man's) tool of the init system running the service, so it's the OS init's jobs to use them or not - and I think some knot-resolver services do use them, but not our systemd-based packages.
Also, control sockets get named by PID sometimes. But again, in
our systemd-based packages we use ID of the instance instead of
PID, because it just seems easier to use.
https://knot-resolver.readthedocs.io/en/stable/daemon-scripting.html#control-sockets
As configuration file is just a lua scripts, there certainly is a
way to write PID into a file on startup, in a few lines of code.