Reputation: 45
I would like to run some code at the startup of an Erlang Application. Is's about to connect to the Database and initialise some things. How can i do this?
Upvotes: 3
Views: 269
Reputation: 1497
You can call the desired functions from the start/2
function of your application's entry module (which implements -behaviour(application)
in it and is specified in your *.app
or *.app.src
if you use rebar).
After you create a release, the start/2
function will be executed when starting the application.
More information about making a release can be found here (assuming rebar
is used).
Upvotes: 6