Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

[erlang-questions] erlsrv on windows 10 problem

421 views
Skip to first unread message

Wes James

unread,
Apr 29, 2016, 11:55:41 AM4/29/16
to erlang-q...@erlang.org
I use erlsrv to install an erlang application on windows.  Windows 7 works fine, but on windows 10, I have to go in and change the service from automatic to Automatic (delayed start), otherwise the app never runs on system start up.  Any idea how to fix this?

I just found this windows command:

sc config SVCNAME start= delayed-auto

I can use that in the install script.

I'd still like it to start with just automatic.  With the delayed option, it takes several extra minutes for the service to start running.

Thanks,

-wes

Dan Gudmundsson

unread,
Apr 30, 2016, 1:59:36 AM4/30/16
to Wes James, erlang-q...@erlang.org
Well you got it run at all, that is something, I have disabled our testing of
services on Windows 10 for now, master branch, since I could not get it run at all. 

From what I googled and understood you will need start the services from an elevated shell, an administer user is not enough. 
But you might already do that or I got it wrong.

Anyway, our Windows knowledge, and priority, is not at the highest level.
So any help would be appreciated.

/Dan

_______________________________________________
erlang-questions mailing list
erlang-q...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions

Wes James

unread,
May 2, 2016, 11:07:46 AM5/2/16
to Dan Gudmundsson, erlang-q...@erlang.org
I have it working on windows 10, as mentioned, I just need to change the start up option in the windows service from Automatic to Automatic (delayed start).  

What can I help with?

-wes

Wes James

unread,
May 2, 2016, 1:27:58 PM5/2/16
to Dan Gudmundsson, erlang-q...@erlang.org
This is with the 18.3 windows binary from erlang.org.

-wes

On Fri, Apr 29, 2016 at 11:59 PM, Dan Gudmundsson <dg...@erlang.org> wrote:

Wes James

unread,
May 2, 2016, 3:51:15 PM5/2/16
to Dan Gudmundsson, erlang-q...@erlang.org
I have a script that I right-click on and select run as administrator, so yes, it has to be done as admin.

This is what I use for win 10 (setup-erlsrv.cmd):

@echo off

@rem
@rem sample erlang install service script
@rem - add then start ecom erlang service
@rem - if it already exists, stop then remove first before adding and starting
@rem 

@set erl_service=0ecom
@erlsrv list %erl_service% | @findstr /i "%erl_service%"
@if errorlevel 1 goto next
@echo.
@rem echo Removing erl service...
@erlsrv remove "%erl_service%"

rem @goto:EOF

:next

@SETLOCAL ENABLEDELAYEDEXPANSION
@SET comp=computer-name

@set module=-s ecom
@set onfail=-onfail restart
@set node=-name ecom@%comp%.nr.usu.edu
@rem echo %node%
@set root=-w "C:/windows/erl"
@set srvc_name=-i 0ecom
@set boot=-boot c:/windows/erl/start_ssl_ecom -proto_dist inet_tls -ssl_dist_opt server_certfile c:/windows/erl/ssl/cert.pem -ssl_dist_opt server_keyfile c:/windows/erl/ssl/key.pem -ssl_dist_opt server_secure_renegotiate true client_secure_renegotiate true
@rem set args=-args "%boot% %module%"
@set args=-args "%boot% %module%"

@echo.
@rem echo Adding erl service...
@erlsrv add "%erl_service%" %node% %root% %onfail% %args%
@echo.
@rem echo Starting erl service...
@erlsrv start %erl_service%
@echo.

:end
@pause
@goto:EOF

-------------

Then I paste this in to an elevated cmd shell (for some reason it won't run from a file) to set the service to automatic delayed:

@FOR /F "delims=" %i IN ('sc getkeyname 0ecom') DO set z=%i
@echo %z%
@for /f "tokens=3" %i IN ("%z%") DO set erl_servicedispname=%i
@echo %erl_servicedispname%

@sc config %erl_servicedispname% start= delayed-auto

-------

I use it to install ecom.beam as a service from this project:


-wes

On Mon, May 2, 2016 at 1:18 PM, Dan Gudmundsson <dan...@gmail.com> wrote:
I do not remember the exact error message now, but what I gathered you had to start erlsrv (and erlang) from an "elevated" shell, otherwise you don't have the permissions to install the services. And we run our automtic tests from a "admin" user but not from an "elevated" shell.

But I don't really know what I'm talking about here, as I said, our windows competence is really low. 

So how you install the services, do you run start erlang from inside
and admin cmd prompt.

Regards
/Dan

Dan Gudmundsson

unread,
May 3, 2016, 3:17:22 AM5/3/16
to Wes James, erlang-q...@erlang.org
Thanks, I figured it should work, but I have disabled the testing since it requires manual starting of elevated cmd shell.

Wes James

unread,
Apr 27, 2017, 1:01:33 PM4/27/17
to Dan Gudmundsson, erlang-q...@erlang.org
I tried this today with 19.3.  I have to set the service to Automatic (Delaye Start) for it to work, like in 18.3.  I looked in the eventviewer and I see these errors:

Error Service Control Manager
Under General Tab
The service terminated with the following error:
The configuration registry key could not be read.

A little further down

Error ErlSrv
Under General Tab
servicename: Could not get registry keys for erlang service.

Which is odd since it does work when delayed.  It's like it's waiting for some other service to start but hasn't yet so it quits.  I'm not sure what it's depending on before starting successfully in delayed start.

-wes

On Fri, Apr 29, 2016 at 11:59 PM, Dan Gudmundsson <dg...@erlang.org> wrote:

Wes James

unread,
Apr 29, 2017, 3:10:06 PM4/29/17
to Dan Gudmundsson, erlang-q...@erlang.org
I found a fix that works for me.  Note this issue is only on windows 10.

Set this registry entry:

Create AutoStartDelay as DWORD 32 bit and set to decimail 1 in this key:

HKLM\SYSTEM\CurrentControlSet\Control\



-wes
Reply all
Reply to author
Forward
0 new messages