I have an Erlang boot script that I can launch like this:
/usr/bin/erl -boot /path/to/my-boot-script
It works when run from console, but fails without any error messages when I run it from systemd. The systemd unit file looks like this:
[Unit]
Description=My daemon written in Erlang
[Service]
Type=simple
ExecStart=/usr/bin/erl -boot /path/to/my-boot-script
Restart=always
[Install]
WantedBy=multi-user.target
The log shows that the system boots properly and then terminates abruptly without any kind of error message. What the hell is going on?
Turns out that you have to pass -noinput
parameter to erl. Otherwise it will try to open stdin for reading, fail because there's nothing there and terminate without any kind of error message.
This works:
[Unit]
Description=My daemon written in Erlang
[Service]
Type=simple
ExecStart=/usr/bin/erl -noinput -boot /path/to/my-boot-script
Restart=always
[Install]
WantedBy=multi-user.target