Launch an escript as a daemon

Hey !

I would like to launch my Escript as a daemon, for using it on a productions server for example.

My thought was to add a --daemon options that will launch it as a daemon: eg ./tasky listen --daemon .

My Escript is using a Cowboy local server and AMQP as a dependency but it shouldn’t be a problem.

So when I have the option --daemon i will launch a Porcelain.spawn("./tasky", []]). This line works but a few seconds later i have a ** (EXIT from #PID<0.145.0>) shutdown . Am I proceeding the good way ? Do you have another idea ?

If you wan’t it to be a demon build a proper release instead of an escript.

Escripts are meant to be “one offs”.

Ok - How can I manage different OS Platform ? (Windows / Linux / MACOSX) for distillery ?

Can I pass option and command with release ? eg. ./tasky listen --env=.env --boot=boot.js

Thanks for the answer

Ok - How can I manage different OS Platform ? (Windows / Linux / MACOSX) for distillery ?

Probably as you have to do with an escript as well, build on the target platform…

Can I pass option and command with release ? eg. ./tasky listen --env=.env --boot=boot.js

I do not know, but for a deamon I do asume the environment is set up already, and to read further configuration either from ENV or disk.

If anyone know how can i launch a release with parameters like : ./tasky foreground listen --env=.env --boot=boot.js