From 20ef6f7cf98b9c44c10bef793a1a51b66c6db416 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Dec 2025 23:26:20 +0000 Subject: [PATCH 1/4] Initial plan From ff0bb9823eb691e25e847790b3d4450f31b0a3ea Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Dec 2025 23:29:37 +0000 Subject: [PATCH 2/4] Update README with platform-specific installation instructions and fixed download links Co-authored-by: RusEu <11183790+RusEu@users.noreply.github.com> --- README.md | 182 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 165 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 07adf0b..2bc8c5e 100644 --- a/README.md +++ b/README.md @@ -17,43 +17,107 @@ ## Quick Start -### 1. Clone and Build +### Installation Options +You can either download a pre-built binary or build from source. + +#### Option 1: Download Pre-built Binary + +**Linux (AMD64)** ```bash -# Clone the repository -git clone https://github.com/RusEu/RadminTelegramBot.git -cd RadminTelegramBot +# Download the latest release +wget https://github.com/RusEu/RadminTelegramBot/releases/download/v1.0.0/server-admin-bot-linux-amd64.tar.gz -# Install Go dependencies -go mod download +# Extract +tar -xzf server-admin-bot-linux-amd64.tar.gz -# Build the binary -go build -o server-admin-bot ./cmd/bot/main.go +# Move to system path +sudo mv server-admin-bot-linux-amd64 /usr/local/bin/server-admin-bot + +# Make executable +sudo chmod +x /usr/local/bin/server-admin-bot +``` + +**Linux (ARM64)** +```bash +# Download the latest release +wget https://github.com/RusEu/RadminTelegramBot/releases/download/v1.0.0/server-admin-bot-linux-arm64.tar.gz + +# Extract +tar -xzf server-admin-bot-linux-arm64.tar.gz # Move to system path -sudo mv server-admin-bot /usr/local/bin/ +sudo mv server-admin-bot-linux-arm64 /usr/local/bin/server-admin-bot # Make executable sudo chmod +x /usr/local/bin/server-admin-bot ``` -**Alternative: Download Pre-built Release** +**macOS (Intel)** +```bash +# Download the latest release +curl -L https://github.com/RusEu/RadminTelegramBot/releases/download/v1.0.0/server-admin-bot-darwin-amd64.tar.gz -o server-admin-bot-darwin-amd64.tar.gz + +# Extract +tar -xzf server-admin-bot-darwin-amd64.tar.gz + +# Move to system path +sudo mv server-admin-bot-darwin-amd64 /usr/local/bin/server-admin-bot + +# Make executable +sudo chmod +x /usr/local/bin/server-admin-bot +``` +**macOS (Apple Silicon)** ```bash -# Download the latest release (replace with your architecture) -wget https://github.com/RusEu/RadminTelegramBot/releases/latest/download/server-admin-bot-linux-amd64.tar.gz +# Download the latest release +curl -L https://github.com/RusEu/RadminTelegramBot/releases/download/v1.0.0/server-admin-bot-darwin-arm64.tar.gz -o server-admin-bot-darwin-arm64.tar.gz # Extract -tar -xzf server-admin-bot-linux-amd64.tar.gz +tar -xzf server-admin-bot-darwin-arm64.tar.gz # Move to system path -sudo mv server-admin-bot /usr/local/bin/ +sudo mv server-admin-bot-darwin-arm64 /usr/local/bin/server-admin-bot # Make executable sudo chmod +x /usr/local/bin/server-admin-bot ``` -### 2. Configure +**Windows (AMD64)** +```powershell +# Download the latest release using PowerShell +Invoke-WebRequest -Uri "https://github.com/RusEu/RadminTelegramBot/releases/download/v1.0.0/server-admin-bot-windows-amd64.zip" -OutFile "server-admin-bot-windows-amd64.zip" + +# Extract (using PowerShell) +Expand-Archive -Path server-admin-bot-windows-amd64.zip -DestinationPath . + +# Run the executable +.\server-admin-bot-windows-amd64.exe -config config.yaml +``` + +> **Note:** Replace `v1.0.0` with the latest version tag. Check the [releases page](https://github.com/RusEu/RadminTelegramBot/releases) for available versions. + +#### Option 2: Build from Source + +```bash +# Clone the repository +git clone https://github.com/RusEu/RadminTelegramBot.git +cd RadminTelegramBot + +# Install Go dependencies +go mod download + +# Build the binary +go build -o server-admin-bot ./cmd/bot/main.go + +# Move to system path (Linux/macOS) +sudo mv server-admin-bot /usr/local/bin/ + +# Make executable (Linux/macOS) +sudo chmod +x /usr/local/bin/server-admin-bot +``` + +### Configuration ```bash # Create config directory @@ -88,7 +152,9 @@ monitoring: disk_alert_threshold: 95 ``` -### 3. Create System Service +#### Linux/macOS System Service + +Create a systemd service file (Linux only): ```bash # Create service file @@ -114,7 +180,7 @@ RestartSec=5 WantedBy=multi-user.target ``` -### 4. Start the Service +#### Starting the Service (Linux) ```bash # Reload systemd @@ -128,6 +194,88 @@ sudo systemctl start server-admin-bot sudo systemctl status server-admin-bot ``` +#### macOS Launch Agent + +For macOS, create a Launch Agent: + +```bash +# Create LaunchAgents directory if it doesn't exist +mkdir -p ~/Library/LaunchAgents + +# Create launch agent plist file +nano ~/Library/LaunchAgents/com.radmin.telegrambot.plist +``` + +Add the following configuration: + +```xml + + + + + Label + com.radmin.telegrambot + ProgramArguments + + /usr/local/bin/server-admin-bot + -config + /etc/server-admin-bot/config.yaml + + RunAtLoad + + KeepAlive + + StandardErrorPath + /tmp/server-admin-bot.err + StandardOutPath + /tmp/server-admin-bot.out + + +``` + +Load and start the agent: + +```bash +# Load the agent +launchctl load ~/Library/LaunchAgents/com.radmin.telegrambot.plist + +# Start the agent +launchctl start com.radmin.telegrambot + +# Check status +launchctl list | grep radmin +``` + +#### Windows Service + +For Windows, you can run the bot as a service using NSSM (Non-Sucking Service Manager) or Task Scheduler: + +**Using NSSM:** + +```powershell +# Download NSSM from https://nssm.cc/download +# Extract nssm.exe to a directory + +# Install the service +.\nssm.exe install ServerAdminBot "C:\Path\To\server-admin-bot-windows-amd64.exe" "-config" "C:\Path\To\config.yaml" + +# Start the service +.\nssm.exe start ServerAdminBot + +# Check service status +.\nssm.exe status ServerAdminBot +``` + +**Using Task Scheduler:** + +1. Open Task Scheduler +2. Create a new task +3. Set trigger to "At startup" +4. Set action to start the program: `server-admin-bot-windows-amd64.exe` +5. Add argument: `-config path\to\config.yaml` +6. Configure to run whether user is logged on or not +7. Save and run the task + ## Getting Your Bot Token 1. Message [@BotFather](https://t.me/BotFather) on Telegram From dc69aadf75ca909e84da4d8d19ed9cd42c7395eb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Dec 2025 23:31:05 +0000 Subject: [PATCH 3/4] Update download comments to clarify version replacement Co-authored-by: RusEu <11183790+RusEu@users.noreply.github.com> --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2bc8c5e..9d940cc 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ You can either download a pre-built binary or build from source. **Linux (AMD64)** ```bash -# Download the latest release +# Download the release (replace v1.0.0 with the latest version) wget https://github.com/RusEu/RadminTelegramBot/releases/download/v1.0.0/server-admin-bot-linux-amd64.tar.gz # Extract @@ -40,7 +40,7 @@ sudo chmod +x /usr/local/bin/server-admin-bot **Linux (ARM64)** ```bash -# Download the latest release +# Download the release (replace v1.0.0 with the latest version) wget https://github.com/RusEu/RadminTelegramBot/releases/download/v1.0.0/server-admin-bot-linux-arm64.tar.gz # Extract @@ -55,7 +55,7 @@ sudo chmod +x /usr/local/bin/server-admin-bot **macOS (Intel)** ```bash -# Download the latest release +# Download the release (replace v1.0.0 with the latest version) curl -L https://github.com/RusEu/RadminTelegramBot/releases/download/v1.0.0/server-admin-bot-darwin-amd64.tar.gz -o server-admin-bot-darwin-amd64.tar.gz # Extract @@ -70,7 +70,7 @@ sudo chmod +x /usr/local/bin/server-admin-bot **macOS (Apple Silicon)** ```bash -# Download the latest release +# Download the release (replace v1.0.0 with the latest version) curl -L https://github.com/RusEu/RadminTelegramBot/releases/download/v1.0.0/server-admin-bot-darwin-arm64.tar.gz -o server-admin-bot-darwin-arm64.tar.gz # Extract @@ -85,7 +85,7 @@ sudo chmod +x /usr/local/bin/server-admin-bot **Windows (AMD64)** ```powershell -# Download the latest release using PowerShell +# Download the release (replace v1.0.0 with the latest version) using PowerShell Invoke-WebRequest -Uri "https://github.com/RusEu/RadminTelegramBot/releases/download/v1.0.0/server-admin-bot-windows-amd64.zip" -OutFile "server-admin-bot-windows-amd64.zip" # Extract (using PowerShell) From 7e83b41431f0095ef45732100c38d926a59582a2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Dec 2025 23:32:23 +0000 Subject: [PATCH 4/4] Fix Windows path format in Task Scheduler instructions Co-authored-by: RusEu <11183790+RusEu@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9d940cc..b2df86b 100644 --- a/README.md +++ b/README.md @@ -272,7 +272,7 @@ For Windows, you can run the bot as a service using NSSM (Non-Sucking Service Ma 2. Create a new task 3. Set trigger to "At startup" 4. Set action to start the program: `server-admin-bot-windows-amd64.exe` -5. Add argument: `-config path\to\config.yaml` +5. Add argument: `-config C:\Path\To\config.yaml` 6. Configure to run whether user is logged on or not 7. Save and run the task