[erlang-questions] erlsrv.html info
Tue Dec 18 11:41:04 CET 2012
On 12/14/2012 11:16 PM, Wes James wrote:
> Looking at this documentation to see where .erlang.cookie might be
> saved for a service (installed with erlsrv) so I don't have to do
> -cookie on the command line, the docs at:
> say that the default working directory is:
> There is a %SystemDrive% in win 7 (type set in the cmd.exe window) but
> there is no %SystemPath%. There is a %windir% and %SystemRoot% which
> are c:\windows on my system. Anyway, I don't see .erlang.cookie in
> c:\windows after using erlsrv and starting the service. Where is
> .erlang.cookie for erlsrv services?
Yes, the %SystemPath% is not present on modern Windows. The local
administrator (which is the user that runs the service) has c:\Windows
as home directory by default, but the service runs with
c:\Windows\system32 as default directory.
One way to make sure is to simply start a service with a debug console
and add -emu_args as a parameter, click "Show message" or whatever your
locale has to select in the dialogue that pops up (or does not pop up
but starts to blink in the task bar) when you start such a service and
then do a pwd(). In the Erlang shell that you will see the -home parameter.
Example (replace mentally any paths with the appropriate ones for your
C:\blabla> cd "c:\Program Files\erl188.8.131.52\erts-184.108.40.206\bin"
C:\Program Files\erl220.127.116.11\erts-18.104.22.168\bin>erlsrv add testservice
-debug console -arg -emu_args
C:\Program Files\erl22.214.171.124\erts-126.96.36.199\bin>erlsrv start testservice
...click on the "show me the message" button in the service control
manager dialogue, which will take you to a blank screen with only the
Erlang shell of the service and a dialogue that can take you back to the
desktop. In that shell, you will see the full command line to the VM
including the '-home' parameter:
Executing: C:\blablabla...\beam.smp.dll C:\blablabla...\beam.smp.dll --
-root C:\blablabla -progname erl -- -home c:\Windows etc etc etc
...click on the get me back button in the dialogue that hangs beside the
shell. The directory after the -home in the "slogan" at the top of the
shell should be the home directory. The result from pwd() is the default
"current directory" of the service.
So the .erlang.cookie should reside in what -home says, which
corresponds to %SystemDrive%%SystemRoot%, while files created in current
directory will go into whatever pwd() shows.
Now stop and remove the service:
C:\Program Files\erl188.8.131.52\erts-184.108.40.206\bin>erlsrv stop testservice
...will take some time because of the peculiarities of a debug console....
C:\Program Files\erl220.127.116.11\erts-18.104.22.168\bin>erlsrv remove service
Hope that helps!
> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions