Hello,
enjoying some trouble time with systemd: when I run daemon binary from CLI, then everything works as expected. When I create service file for systemd and start it, it seems to work properly, but the daemon does not honor any of the command line parameters and continues with defaults. Tested on Raspberry Pi model B+ (ARM), basic installation. I am new to Pi, but kind of an old timer with Arch on x86.
First example is when /usr/bin/ebusd is started in terminal (the /etcWRONG/ebusd path is there for purpose, so that I can see if it is parsed or not by the daemon):
$this->bbcode_second_pass_code('', '$ sudo /usr/bin/ebusd --configpath /etcWRONG/ebusd --logfile /var/log/ebusd-remote/ebusd.log --dumpfile /var/log/ebusd-remote/ebusd.dump --dumpsize 100000 --dump')
$this->bbcode_second_pass_code('', '$ 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')
Everything is great: ebusd complains about missing file/element, because the path /etcWRONG/ebusd does not exist and also the log file is in the defined path.
$this->bbcode_second_pass_code('', '$ 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 readable')
Now is the time for systemd:
$this->bbcode_second_pass_code('', '$ 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.target')
The parameters of the process are the same:
$this->bbcode_second_pass_code('', '$ 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 --dump')
However, the config path is ignored, the log file is ignored:
$this->bbcode_second_pass_code('', '$ 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: 0')
/usr/bin/ebusd forks itself to the background, hence the Type=forking.
Anybody has an idea, what's wrong?