Hello all!
What is the best way to make Erlang application runnable from shell? Using Bash? Using Escript?
Is there any examples or manuals of it?
Beside all of it how to add this scripts to rebar3?
rebar3 escriptize is an option, and bakeware creates a standalone binary but is more Elixir focused.
Is there any examples of escriptize? Tried to find any but got failed.
I’ve referenced this small example to get started before How to launch an application created using "rebar3 new app" and "rebar3 escriptize"? · Issue #1740 · erlang/rebar3 · GitHub
You can make an example escript app with:
rebar3 new escript cool_proj
Beware sometimes escript handles things weird, so don’t be surprised if something that normally works doesn’t…
If you can use erlang.mk to meet your needs, the command is as follows (the specific principle of its implementation I did not delve into) :
发布 (Release)
IMBOYENV=prod make rel
IMBOYENV=test make rel
IMBOYENV=dev make rel -j8
IMBOYENV=local make rel
复制代码到特定的目录 (Copy code to a specific directory)
cp ./_rel/imboy/imboy-1.0.0.tar.gz
// or
scp ./_rel/imboy/imboy-1.0.0.tar.gz root@192.168.2.207:/usr/local/imboy/
去启动服务 (To start the service)
mkdir -p /usr/local/imboy
cp ./_rel/imboy/imboy-1.0.0.tar.gz /usr/local/imboy/
cd /usr/local/imboy
tar -xzf imboy-1.0.0.tar.gz
bin/imboy console
bin/imboy start
bin/imboy restart
bin/imboy stop
Thx a lot. Made it working for myself.