|
|
| Author |
Message |
|
| icimjs at loop.com |
Posted: Mon Feb 08, 1999 9:43 pm |
|
|
|
Guest
|
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
Post generated using Mail2Forum (http://m2f.sourceforge.net) |
|
|
| Back to top |
|
| ulf.wiger at etxb.ericsso |
Posted: Tue Feb 09, 1999 6:58 am |
|
|
|
Guest
|
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.
/Uffe
--
Ulf Wiger, Chief Designer AXD 301 <ulf.wiger_at_etxb.ericsson.se>
Ericsson Telecom AB tfn: +46 8 719 81 95
Varuv |
|
|
| Back to top |
|
| ulf.wiger at etxb.ericsso |
Posted: Tue Feb 09, 1999 7:18 am |
|
|
|
Guest
|
Ulf Wiger wrote:
>
>
> 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.
>
Ok, confession time.
I *have* done this myself in production code:
patch_load_mnesia(Dir) ->
application:load(mnesia),
application_controller:set_env(mnesia, dir, Dir).
After this, you may issue application:start(mnesia).
I do this in an installation program, which also configures a start
command and a sys.config file. After that, all parameters are set
correctly every time the system is started.
However, there is also a function, mnesia:start(ExtraEnv), which does
the same thing. It is not official either, so I guess it's just a matter
of choosing your favourite undocumented feature and running with it. ;)
I still recommend messing with the env variables at installation only,
and not afterwards.
/Uffe
--
Ulf Wiger, Chief Designer AXD 301 <ulf.wiger_at_etxb.ericsson.se>
Ericsson Telecom AB tfn: +46 8 719 81 95
Varuv |
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|