简体   繁体   中英

Run code at startup of an Erlang Application

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?

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM