summaryrefslogtreecommitdiff
path: root/priv/templates/simplenode.windows.runner.cmd
diff options
context:
space:
mode:
Diffstat (limited to 'priv/templates/simplenode.windows.runner.cmd')
-rw-r--r--priv/templates/simplenode.windows.runner.cmd36
1 files changed, 32 insertions, 4 deletions
diff --git a/priv/templates/simplenode.windows.runner.cmd b/priv/templates/simplenode.windows.runner.cmd
index b9c5824..ef9765d 100644
--- a/priv/templates/simplenode.windows.runner.cmd
+++ b/priv/templates/simplenode.windows.runner.cmd
@@ -2,7 +2,7 @@
@set node_name={{nodeid}}
-@rem Get the abolute path to the parent directory,
+@rem Get the absolute path to the parent directory,
@rem which is assumed to be the node root.
@for /F "delims=" %%I in ("%~dp0..") do @set node_root=%%~fI
@@ -14,20 +14,28 @@
@call :set_trim release_version %%J
)
+@rem extract erlang cookie from vm.args
+@set vm_args=%releases_dir%\%release_version%\vm.args
+@for /f "usebackq tokens=1-2" %%I in (`findstr /b \-setcookie %vm_args%`) do @set erlang_cookie=%%J
+
@set erts_bin=%node_root%\erts-%erts_version%\bin
@set service_name=%node_name%_%release_version%
+@if "%1"=="usage" @goto usage
@if "%1"=="install" @goto install
@if "%1"=="uninstall" @goto uninstall
@if "%1"=="start" @goto start
@if "%1"=="stop" @goto stop
@if "%1"=="restart" @call :stop && @goto start
@if "%1"=="console" @goto console
-@rem TODO: attach, ping, restart and reboot
+@if "%1"=="query" @goto query
+@if "%1"=="attach" @goto attach
+@if "%1"=="upgrade" @goto upgrade
+@echo Unknown command: "%1"
:usage
-@echo Usage: %0 {install|uninstall|start|stop|restart|console}
+@echo Usage: %~n0 {install,uninstall,start,stop,restart,console,query,attach,upgrade}
@goto :EOF
:install
@@ -48,7 +56,27 @@
@goto :EOF
:console
-@start %erts_bin%\werl.exe -boot %releases_dir%\%release_version%\%node_name%
+@start %erts_bin%\werl.exe -boot %releases_dir%\%release_version%\%node_name% -config %releases_dir%\%release_version%\sys.config -args_file %vm_args% -sname %node_name%
+@goto :EOF
+
+:query
+@%erts_bin%\erlsrv.exe list %service_name%
+@exit /b %ERRORLEVEL%
+@goto :EOF
+
+:attach
+@for /f "usebackq" %%I in (`hostname`) do @set hostname=%%I
+start %erts_bin%\werl.exe -boot %releases_dir%\%release_version%\start_clean -remsh %node_name%@%hostname% -sname console -setcookie %erlang_cookie%
+@goto :EOF
+
+:upgrade
+@if "%2"=="" (
+ @echo Missing upgrade package argument
+ @echo Usage: %~n0 upgrade {package base name}
+ @echo NOTE {package base name} MUST NOT include the .tar.gz suffix
+ @goto :EOF
+)
+@%erts_bin%\escript.exe %node_root%\bin\install_upgrade.escript %node_name% %erlang_cookie% %2
@goto :EOF
:set_trim