Portál AbcLinuxu, 10. května 2025 09:19
$ sudo /usr/bin/ebusd --configpath /etcWRONG/ebusd --logfile /var/log/ebusd-remote/ebusd.log --dumpfile /var/log/ebusd-remote/ebusd.dump --dumpsize 100000 --dump
$ ps aux | grep /usr/bin/ebusd root 5832 0.0 0.2 38392 1080 ? Ssl 11:23 0:00 /usr/bin/ebusd --configpath /etcWRONG/ebusd --logfile /var/log/ebusd-remote/ebusd.log --dumpfile /var/log/ebusd-remote/ebusd.dump --dumpsize 100000 --dump
$ cat /var/log/ebusd-remote/ebusd.log 2015-01-24 11:23:09.646 [bas event] ebusd started 2015-01-24 11:23:09.647 [bas trace] path to ebus configuration files: /etcWRONG/ebusd 2015-01-24 11:23:09.648 [bas error] error reading templates: ERR: file/element not found or not readable 2015-01-24 11:23:09.648 [bas error] error reading config files: ERR: file/element not found or not readableA nyní systemd:
$ cat ebusd.service [Unit] Description=Communication interface to the energy bus (ebus) After=local-fs.target ConditionPathExists=/var/log [Service] Type=forking EnvironmentFile=-/etc/conf.d/ebusd ExecStart=/usr/bin/ebusd ${EBUSD_ARGS} PIDFile=/run/ebusd.pid [Install] WantedBy=multi-user.targetMohu-li soudit, tak parametry procesu jsou shodné:
$ ps aux | grep /usr/bin/ebusd root 5774 0.0 0.2 46584 1260 ? Ssl 10:47 0:00 /usr/bin/ebusd --configpath /etcWRONG/ebusd --logfile /var/log/ebusd-remote/ebusd.log --dumpfile /var/log/ebusd-remote/ebusd.dump --dumpsize 100000 --dumpJenže jsou ignorovány; log leží jinde, výchozí konfiguraci to čte z /etc/ebusd místo /etcWRONG/ebusd:
$ cat /var/log/ebusd.log 2015-01-24 10:47:39.898 [bas event] ebusd started 2015-01-24 10:47:39.899 [bas trace] path to ebus configuration files: /etc/ebusd 2015-01-24 10:47:39.935 [bas trace] read templates 2015-01-24 10:47:39.938 [bas trace] read config files 2015-01-24 10:47:39.939 [bas event] message DB: 4 2015-01-24 10:47:39.940 [bas event] updates DB: 0 2015-01-24 10:47:39.940 [bas event] polling DB: 0Co je to za podivnost? Vyžaduje systemd od démona nějaké specifické vlastnosti? (/usr/bin/ebusd sám forkuje a běží na pozadí, což by mělo být klasické chování a odpovídá tomu "Type=forking".) Arch Linux, ARM.
Řešení dotazu:
$ cat /etc/conf.d/ebusd # /etc/conf.d/ebusd: config file for ebusd.service # Options to pass to the ebusd. # See the ebusd -h for more info. EBUSD_ARGS=--configpath /etcNONEXISTENT/ebusd --logfile /tmp/ebusd.logtak jsem je tam pro další testování zase vrátil Navedlo mne to ovšem správným směrem. V ebusd.service jsem změnil
ExecStart=/usr/bin/ebusd ${EBUSD_ARGS}
na ExecStart=/usr/bin/ebusd $EBUSD_ARGS
et voilà, funguje to!
Manuál systemd říká, že je to feature a ne bug:
Basic environment variable substitution is supported. Use "${FOO}" as part of a word, or as a word of its own, on the command line, in which case it will be replaced by the value of the environment variable including all whitespace it contains, resulting in a single argument. Use "$FOO" as a separate word on the command line, in which case it will be replaced by the value of the environment variable split at whitespace resulting in zero or more arguments. For this type of expansion, quotes and respected when splitting into words, and afterwards removed.
V každém případě velmi děkuji za nakopnutí, škoda, že jsem na tom strávil tolik času.
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.