john30 / ebusd

daemon for communication with eBUS heating systems
GNU General Public License v3.0
577 stars 132 forks source link

can't run 2 different ebusd.service #1291

Closed maik-dmxc closed 3 months ago

maik-dmxc commented 4 months ago

Description

on older PI4 with Bullseye i was running 2 ebusd#.service that grabs the related config from /etc/default/ebusd two Adapters where defined

EBUSD_OPTS1="--configpath=/etc/ebusd/ --lograwdata=bytes --latency=100000 --receivetimeout=100000 --scanconfig -d /dev/serial/by-id/usb-E-Service_eBus_Coupler_Iso_12001_ALHTFOL-if00-port0 -p 8890 -l /var/log/ebusd1.log"
EBUSD_OPTS2="--configpath=/etc/ebusd/ --lograwdata=bytes --latency=100000 --receivetimeout=100000 -a ff --scanconfig=08 -d /dev/serial/by-id/usb-E-Service_eBus_Coupler_Iso_12001_ALHTIL2-if00-port0 -p 8889 -l /var/log/ebusd2.log"

now there is an error

Jun 23 09:31:18 raspberrypi ebusd[8505]: invalid argument --opts1
Jun 23 09:31:18 raspberrypi ebusd[8505]: 2024-06-23 09:31:18.886 [main error] invalid/unknown argument in env (ignored): EBUSD_OPTS1=--configpath=/etc/e>
Jun 23 09:31:18 raspberrypi ebusd[8505]: invalid argument --opts2
Jun 23 09:31:18 raspberrypi ebusd[8505]: 2024-06-23 09:31:18.886 [main error] invalid/unknown argument in env (ignored): EBUSD_OPTS2=--configpath=/etc/e>
pi@raspberrypi:~ $ systemctl status ebusd1.service
● ebusd1.service - ebusd, the daemon for communication with eBUS heating systems.
     Loaded: loaded (/etc/systemd/system/ebusd1.service; enabled; preset: enabled)
     Active: active (running) since Sun 2024-06-23 08:47:44 CEST; 34min ago
    Process: 1615 ExecStart=/usr/bin/ebusd $EBUSD_OPTS1 (code=exited, status=0/SUCCESS)
   Main PID: 1620 (ebusd)
      Tasks: 0 (limit: 3909)
        CPU: 19ms
     CGroup: /system.slice/ebusd1.service
             ‣ 1620 /usr/bin/ebusd --configpath=/etc/ebusd/ --lograwdata=bytes --latency=100000 --receivetimeout=100000 -a ff --scanconfig=08 -d /dev/serial/by-id/usb-E-Service_eBus_Coupler_Iso_12001_ALHTIL2-if00-port0 -p 8889 -l /var/log/ebusd2.log

Jun 23 08:47:44 raspberrypi systemd[1]: Starting ebusd1.service - ebusd, the daemon for communication with eBUS heating systems....
Jun 23 08:47:44 raspberrypi ebusd[1615]: invalid argument --opts1
Jun 23 08:47:44 raspberrypi ebusd[1615]: 2024-06-23 08:47:44.982 [main error] invalid/unknown argument in env (ignored): EBUSD_OPTS1=--configpath=/etc/ebusd/ --lograwdata=bytes --latency=100000 --receivetimeout=100000 --scanconfig -d /dev/serial/by-id/usb-E-Service_eBus_Coupler_Iso_12001_ALHTFOL-if00-port0 >
Jun 23 08:47:44 raspberrypi ebusd[1615]: invalid argument --opts2
Jun 23 08:47:44 raspberrypi ebusd[1615]: 2024-06-23 08:47:44.982 [main error] invalid/unknown argument in env (ignored): EBUSD_OPTS2=--configpath=/etc/ebusd/ --lograwdata=bytes --latency=100000 --receivetimeout=100000 -a ff --scanconfig=08 -d /dev/serial/by-id/usb-E-Service_eBus_Coupler_Iso_12001_ALHTIL2-if>
Jun 23 08:47:44 raspberrypi systemd[1]: Started ebusd1.service - ebusd, the daemon for communication with eBUS heating systems..

Actual behavior

ebusd has two EBUSD_OPTS 1 & 2 now they are ignored,

 ebusd[1616]: invalid argument --opts1
Jun 23 08:47:44 raspberrypi ebusd[1616]: 2024-06-23 08:47:44.979 [main error] invalid/unknown argument in env (ignored): EBUSD_OPTS1=--configpath=/etc/eb
Jun 23 08:47:44 raspberrypi ebusd[1616]: invalid argument --opts2
Jun 23 08:47:44 raspberrypi ebusd[1616]: 2024-06-23 08:47:44.979 [main error] invalid/unknown argument in env (ignored): EBUSD_OPTS2=--configpath=/etc/eb
J

ebusd1.service and ebusd2.service is started with same OPTS

Expected behavior

starting ebusd1.service grabs OPTS1 starting ebusd2.service garbs OPST2

ebusd version

current source from git

ebusd arguments

pi@raspberrypi:~ $ cat /etc/default/ebusd # /etc/default/ebusd: # config file for ebusd service. # Options to pass to ebusd (run "ebusd -?" for more info): EBUSD_OPTS="--scanconfig" # MULTIPLE EBUSD INSTANCES WITH SYSV # In order to run multiple ebusd instances on a SysV enabled system, simply # define several EBUSD_OPTS with a unique suffix for each. Recommended is to # use a number as suffix for all EBUSD_OPTS settings. That number will then be # taken as additional "instance" parameter to the init.d script in order to # start/stop an individual ebusd instance instead of all instances. # Example: (uncomment the EBUSD_OPTS above) #EBUSD_OPTS1="--scanconfig -d /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A50285BI-if00-port0 -p 8888 -l /var/log/ebusd1.log" #EBUSD_OPTS2="--scanconfig -d /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A900acTF-if00-port0 -p 8889 -l /var/log/ebusd2.log" #EBUSD_OPTS3="--scanconfig -d /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A900beCG-if00-port0 -p 8890 -l /var/log/ebusd3.log" EBUSD_OPTS1="--configpath=/etc/ebusd/ --lograwdata=bytes --latency=100000 --receivetimeout=100000 --scanconfig -d /dev/serial/by-id/usb-E-Service_eBus_Coupler_Iso_12001_ALHTFOL-if00-port0 -p 8890 -l /var/log/ebusd1.log" EBUSD_OPTS2="--configpath=/etc/ebusd/ --lograwdata=bytes --latency=100000 --receivetimeout=100000 -a ff --scanconfig=08 -d /dev/serial/by-id/usb-E-Service_eBus_Coupler_Iso_12001_ALHTIL2-if00-port0 -p 8889 -l /var/log/ebusd2.log" # MULTIPLE EBUSD INSTANCES WITH SYSTEMD # In order to run muiltiple ebusd instances on a systemd enabled system, just # copy the /lib/systemd/system/ebusd.service file to /etc/systemd/system/ # with a different name (e.g. ebusd-2.service), remove the line starting with # 'EnvironmentFile=', and replace the '$EBUSD_OPTS' with the options for that # particular ebusd instance.

Operating system

Debian 12 (Bookworm) / Ubuntu 22-23 / Raspberry Pi OS 12 (including lite)

CPU architecture

x64

Dockerized

None

Hardware interface

other

Related integration

TCP (cmdline client like ebusctl or netcat)

Logs

2024-06-23 09:30:01.003 [main notice] SIGTERM received 2024-06-23 09:30:01.111 [bus error] device status: transport closed 2024-06-23 09:30:01.112 [main notice] ebusd stopped 2024-06-23 09:30:31.379 [main error] can't open pidfile: /var/run/ebusd.pid, exiting 2024-06-23 09:30:31.380 [main notice] ebusd stopped 2024-06-23 09:31:18.898 [bus notice] device status: transport opened 2024-06-23 09:31:18.899 [main notice] ebusd 23.3.23.3 started with single scan on device: /dev/serial/by-id/usb-E-Service_eBus_Coupler_Iso_12001_ALHTIL2-if00-port0, serial 2024-06-23 09:31:18.901 [bus notice] bus started with own address ff/04

john30 commented 3 months ago

ebusd also picks up arguments from environment variables prefixed with EBUSD_ and thus the EBUSD_OPTS might be an unelegant choice in the systemd file. nevertheless it starts up regularly and only gives that message as hint to something is fishy. I'll change the log level of that one. if you want to get rid of it completely, simply rename it in the systemd file and defaults