commit f5985ad3d2440991a7da8e221a84ec231aa007bd Author: elpatron Date: Sat Jan 18 17:25:37 2025 +0100 first commit diff --git a/agent.exe b/agent.exe new file mode 100644 index 0000000..4fc60d7 Binary files /dev/null and b/agent.exe differ diff --git a/install-beszel-service.cmd b/install-beszel-service.cmd new file mode 100644 index 0000000..9347fe5 --- /dev/null +++ b/install-beszel-service.cmd @@ -0,0 +1,28 @@ +@echo off +if !%1==! goto help +if !%2==! goto help + +set BESZELKEYPREFIX=%1 +set BESZELKEY=%2 +set SERVICENAME=BeszelAgent +set DESTINATIONDIR=%ProgramFiles%\%SERVICENAME% +set AGENTEXE=%DESTINATIONDIR%\agent.exe + +winget install nssm +rem Refresh the environment to start nssm from %PATH% +rem Call RefreshEnv.cmd from Chocolatey: +call .\RefreshEnv.cmd + +md "%DESTINATIONDIR%" +copy .\agent.exe "%DESTINATIONDIR%\" +netsh advfirewall firewall add rule name="%SERVICENAME%" dir=in action=allow program="%AGENTEXE%" enable=yes +nssm install %SERVICENAME% "%AGENTEXE%" +nssm set %SERVICENAME% AppEnvironmentExtra "KEY=%BESZELKEYPREFIX% %BESZELKEY%" +nssm start %SERVICENAME% +nssm dump %SERVICENAME% +goto end + +:help +echo You have to provide a Beszel ssh key, e.g. 'install-beszel-service.cmd ssh-ed25519 AAAAC3L3lIpn94iu2TIpdmneXsEC1TDvrg4HCNoM1aiC683WMZfGOVoatrJSkysaQB9K + +:end \ No newline at end of file