[erlang-questions] Setting up a startup service
asdf asdf
codewiget95@REDACTED
Mon Dec 18 23:55:15 CET 2017
Hello all,
I have built an Erlang program and created a release using rebar3 release. To run this program, I use the command:
./_build/default/rel/program/bin/program start
What I would like to do now is have this program start on startup whenever the box boots or whenever the VM crashes. I have to use a RHEL 7 box for this, so I am using systemd. I created a service below:
[Unit]
Description=program
After=network.target
[Service]
Type=simple
User=root
ExecStart=/home/root/repos/program/_build/default/rel/program/bin/program start
Restart=on-abort
[Install]
WantedBy=multi-user.target
This doesn’t work however - I get the following output:
Dec 18 17:43:59 localhost.localdomain systemd[1]: Started program.
Dec 18 17:43:59 localhost.localdomain systemd[1]: Starting program…
(It is odd that it says “started program” followed by “starting program”…)
Now here is the interesting part - if I switch out “start” with “console” , I get good output - I get the successful start message. But then a crash… :
Dec 18 17:45:40 localhost.localdomain program[14167]: 17:45:40.429 [info] Application program started on node 'program@REDACTED'
Dec 18 17:45:40 localhost.localdomain program[14167]: Eshell V8.2.2 (abort with ^G)
Dec 18 17:45:40 localhost.localdomain program 14167]: (program@REDACTED)1> *** Terminating erlang ('program@REDACTED’)
This crash is expected though, because I tried to start it in console but it was a background process. My point though is that it starts up, but for some unknown reason it is exiting. On top of that, all of the log files in _build/default/rel/program/log are empty, so I’m not getting any valuable info on why it isn’t starting.
And to clarify, I have copy/pasted the ExecStart command from the file to the command line and it works when it is run from the command line, so this isn’t a path issue.
Does anyone have any idea as to what I am doing wrong?
Thank you in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20171218/8b308e60/attachment.htm>
More information about the erlang-questions
mailing list