Ulf Wiger ulf.wiger@REDACTED
Tue Feb 9 07:58:40 CET 1999

Elan wrote:
> Hi,
> the mnesia manual says that erl should be started with
> -config <path>
> pointing at the directory in which the tables are stored. I'd rather set
> that path programmatically. Can that be done? How?
> TIA,
> Elan

I believe that it's really -mnesia dir <Dir>

The 'dir' parameter can be set from the command line:

	erl -name <Name> -mnesia dir <Dir>

or in a "config" file, which is identified with the parameter 'config'

	erl -name <Name> -config <ConfFile>

For various reasons, the file should be named sys.config, and has the
following format:

[{AppName1, [{EnvVar, Val}]}].

For example:

	[{mnesia, [{dir, "/home/joe/test/mnesia.n1"},
	           {embedded_mnemnosyne, false}]},
	 {kernel, [{start_ddll, true},
		   {start_disk_log, true}]}].

Setting the environment variables programmatically *can* be done, but
you have to use an internal function in the application_controller: 

	application_controller:set_env(AppName, Key, Value)

It is not recommended, and you will not find the function in any manual.

What I do is that I generate the sys.config file programmatically during
an installation phase. I don't think it's such a good idea to be
changing those variables in a running system anyway - better to create a
static configuration and then start the erlang node from it.

Ulf Wiger, Chief Designer AXD 301     <ulf.wiger@REDACTED>
Ericsson Telecom AB                          tfn: +46  8 719 81 95
Varuvägen 9, Älvsjö                          mob: +46 70 519 81 95
S-126 25 Stockholm, Sweden                   fax: +46  8 719 43 44

More information about the erlang-questions mailing list