Script to run erlang code

I am trying to create a script on ubuntu to run some Erlang code:

The script looks something like this:

#!/bin/sh

EBIN=$HOME/path_to_beams

ERL=/usr/local/bin/erl
export HEART_COMMAND="$EBIN/starting_script start"

case $1 in

  start)
    $ERL -sname mynode -pa $EBIN \
         -heart -detached -s my_module start_link
    ;;

  *)
    echo "Usage: $0 {start|stop|debug}"
    exit 1
esac

exit 0

but I have a couple of problems.

First of all, the code can be executed only if the script is in the same directory as the bundles, it seems strange to me, I double-checked the paths, so why doesn't the -pa flag work?

Secondly, the script (without -pa) works fine, but if I try to start its supervisor (-s my_module_sup start_link) instead of the main module (gen_server), it does not work ... this is strange, because if I start the supervisor from normal shell, everything works fine.

Thirdly, the -heart flag should restart the script in case of failure, but if I kill this process with the usual Unix removal, the process will not be restarted.

- ?

,

PDN

+3
1

, , , erlexport erl. , ( erlexport). erl.

-heart , Erlang node , . , Erlang , .

+1

Source: https://habr.com/ru/post/1780017/


All Articles