I have an Erlang program that runs in the Erlang shell, and I want to control it.
This is what I want:
- When the machine starts, the Erlang shell must start with it, as well as the program that runs in the shell.
- If the Erlang shell crashes for any reason, it must be restarted.
- You should be able to manually start / stop / restart the Erlang shell.
Example:
/etc/init.d/foobar start /etc/init.d/foobar stop /etc/init.d/foobar restart
I did not start with the whole “restart myself if it crashes,” but still got stuck with ease, or is it easy?
I have done the following:
Took the skeletal code from /etc/init.d/skeleton and replaced PATH, DESC, NAME, etc. etc .... It works, I can do:
/etc/init.d/foobar start
However, I can’t stop it ... The fact is that I run the Erlang shell with "erl", which is a script that does some bizarre things that I don’t understand. It is one thing to create a very long and complex process name. This is not just "erl" like this:
/usr/lib/erlang/erts-5.7.4/bin/beam.smp - -root / usr / lib / erlang -progname erl - -home / home / xxx -.... and some more.
Is there a better way to do this?
OS: Ubuntu 11.04
source share