Add update_agent.cmd
This commit is contained in:
52
README.md
52
README.md
@@ -1,31 +1,55 @@
|
||||
# Install Beszel Agent As Service Under Windows
|
||||
# BeszelWin
|
||||
|
||||
The Windows *cmd* file `install-beszel-service.cmd` installs the [Beszel](https://beszel.dev) agent as a service under Microsoft Windows.
|
||||
Build and install the [Beszel](https://beszel.dev) agent under Microsoft Windows.
|
||||
|
||||
## Prerequisites
|
||||
## (1) Building the executable
|
||||
|
||||
- Microsoft Windows 10 or later (32 or 64 bit)
|
||||
- Git installed
|
||||
### Prerequisites
|
||||
|
||||
If you don´t have Git installed, either
|
||||
- Microsoft Windows 10 or later **Client** OS (64 bit)
|
||||
|
||||
- install Git with Winget: `winget install git.git` or
|
||||
- download and extract the ZIP file from [Releases](https://gitea.elpatron.me/elpatron/Install-Beszel-Agent/releases/).
|
||||
*Building under Windows Server OS should be working, but you have to install Go and Git manually as Winget is not available for Windows server operating systems.*
|
||||
|
||||
## Usage
|
||||
### Compiling
|
||||
|
||||
Download and extract [install-beszel-service.zip](https://gitea.elpatron.me/elpatron/Install-Beszel-Agent/releases/download/1.0/install-beszel-service.zip).
|
||||
|
||||
Open a `cmd.exe` shell and start the build-script:
|
||||
|
||||
```
|
||||
.\build_agent.cmd
|
||||
```
|
||||
|
||||
The script will install *Git* and *Go* (if not yet installed) with *Winget*, clone the *Beszel* repository and build a Windows 64 bit `agent.exe` binary.
|
||||
|
||||
## (2) Installing the service
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Microsoft Windows 10 or later (32 or 64 bit) - *Server OS should work, too*
|
||||
|
||||
### Installation
|
||||
|
||||
Download and extract [install-beszel-service.zip](https://gitea.elpatron.me/elpatron/Install-Beszel-Agent/releases/download/1.0/install-beszel-service.zip) if you haven´t done this in *(1) Building the executable*.
|
||||
|
||||
Open a `cmd.exe` shell with **administrative rights** .
|
||||
|
||||
If you have built the agent by yourself: Copy your `agent.exe` binary to the directory where you extracted the scripts. Overwrite `agent.exe` from the archive.
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
copy /y .\beszel\beszel\cmd\agent\agent.exe .
|
||||
```
|
||||
|
||||
Start the installation script provided with your Beszel Ssh key:
|
||||
|
||||
````
|
||||
git clone https://gitea.elpatron.me/elpatron/Install-Beszel-Agent
|
||||
cd Install-Beszel-Agent
|
||||
.\install-beszel-service.cmd <your Beszel ssh key>
|
||||
````
|
||||
|
||||
## Explanation
|
||||
|
||||
The script copies `agent.exe` into the directory `%ProgramFiles%\BeszelAgent` and takes usage of *[NSSM - the Non-Sucking Service Manager](https://nssm.cc/)* to install the service. If *NSSM* is not yet installed on your system, it will be downloaded and installed to the Beszel agent directory.
|
||||
|
||||
The provided `agent.exe` was compiled on January, 17th 2025 by me and should be exchanged by a self compiled or official executable.
|
||||
The provided `agent.exe` was compiled on January, 17th 2025 by me and should be exchanged by a self compiled or official executable, see *(1) Building the executable*.
|
||||
|
||||
For more details, see [*Using Beszel to monitor Windows*](https://blog.ktz.me/using-beszel-to-monitor-windows/) by Alex Kretschmar.
|
@@ -1,5 +1,19 @@
|
||||
@echo off
|
||||
cd /D "%~dp0"
|
||||
echo This script installs the Beszel agent for Windows.
|
||||
echo If not yet installed, NSSM will be installed via Winget.
|
||||
echo.
|
||||
|
||||
echo Checking adminstrative rights
|
||||
rem from https://stackoverflow.com/questions/7985755/how-to-detect-if-cmd-is-running-as-administrator-has-elevated-privileges
|
||||
net session >nul 2>&1
|
||||
if %errorlevel% equ 0 (
|
||||
echo Administrative rights check OK
|
||||
) else (
|
||||
echo You are NOT Administrator. Start the script from an administrative cmd.exe shell...
|
||||
goto end
|
||||
)
|
||||
|
||||
if !%1==! goto help
|
||||
if !%2==! goto help
|
||||
|
||||
|
Reference in New Issue
Block a user