#9 feat: systemd install script

Uzavrená
otvorené 9 mesiacov pred užívateľom fszontagh · 4 komentárov

Create an install and uninstall shell script which substitutes the project's correct path and creates the correct systemd config file for the project and copies into the systemd config directory.

Create an install and uninstall shell script which substitutes the project's correct path and creates the correct systemd config file for the project and copies into the systemd config directory.
Claude Coding Agent okomentoval 9 mesiacov pred
Spolupracovník

I'll create the install and uninstall scripts for the systemd service.

The scripts will:

  • ✅ Automatically detect the project's installation path
  • ✅ Substitute correct paths and user information in the systemd service file
  • ✅ Copy the service file to /etc/systemd/system/
  • ✅ Handle systemd daemon reload, enable, and start operations
  • ✅ Provide an uninstall script to stop, disable, and remove the service
  • ✅ Include proper error handling and user prompts
  • ✅ Verify prerequisites (Node.js version, systemd availability)

Starting implementation now...

I'll create the install and uninstall scripts for the systemd service. The scripts will: - ✅ Automatically detect the project's installation path - ✅ Substitute correct paths and user information in the systemd service file - ✅ Copy the service file to `/etc/systemd/system/` - ✅ Handle systemd daemon reload, enable, and start operations - ✅ Provide an uninstall script to stop, disable, and remove the service - ✅ Include proper error handling and user prompts - ✅ Verify prerequisites (Node.js version, systemd availability) Starting implementation now...
Claude Coding Agent okomentoval 9 mesiacov pred
Spolupracovník

Implementation Complete!

I've created the systemd installation and uninstallation scripts as requested.

📁 Created Files

1. install.sh - Automated Installation Script

Features:

  • ✅ Automatically detects project directory (no hardcoded paths)
  • ✅ Detects current user and group to run the service
  • ✅ Verifies Node.js is installed and >= 18.0.0
  • ✅ Checks systemd availability
  • ✅ Creates .env and commands.json from examples if missing
  • ✅ Substitutes correct paths in service file:
    • WorkingDirectory → detected project path
    • User → current user
    • Group → current user's group
    • ExecStart → detected Node.js path + src/index.js
    • ReadWritePaths → project directory
  • ✅ Copies service file to /etc/systemd/system/
  • ✅ Reloads systemd daemon
  • ✅ Enables service (auto-start on boot)
  • ✅ Optionally starts the service immediately
  • ✅ Shows service status and useful commands
  • ✅ Interactive prompts with confirmation
  • ✅ Colored output for better readability
  • ✅ Error handling and validation

2. uninstall.sh - Automated Uninstallation Script

Features:

  • ✅ Stops the running service
  • ✅ Disables the service (won't start on boot)
  • ✅ Removes service file from /etc/systemd/system/
  • ✅ Reloads systemd daemon
  • ✅ Preserves project files and configuration
  • ✅ Interactive confirmation prompt
  • ✅ Clear status messages
  • ✅ Error handling

📖 Documentation Updated

Updated SYSTEMD.md to include:

  • Quick installation section (recommended method)
  • Instructions for both automated and manual installation
  • Clear distinction between the two approaches

🚀 Usage

Install the service:

cd /home/claude/agent-manager
./install.sh

Uninstall the service:

./uninstall.sh

Both scripts are executable and ready to use. The install script will prompt for confirmation before making changes, and will ask if you want to start the service immediately after installation.

✨ Key Benefits

  1. Zero Configuration: Scripts automatically detect all necessary paths and settings
  2. Safe: Interactive prompts prevent accidental installation/removal
  3. Flexible: Works in any directory, for any user
  4. Validated: Checks prerequisites before proceeding
  5. User-Friendly: Clear colored output and helpful messages
  6. Complete: Handles the entire lifecycle from install to uninstall

The scripts are production-ready and follow best practices for shell scripting with proper error handling and validation.

✅ **Implementation Complete!** I've created the systemd installation and uninstallation scripts as requested. ## 📁 Created Files ### 1. `install.sh` - Automated Installation Script Features: - ✅ Automatically detects project directory (no hardcoded paths) - ✅ Detects current user and group to run the service - ✅ Verifies Node.js is installed and >= 18.0.0 - ✅ Checks systemd availability - ✅ Creates `.env` and `commands.json` from examples if missing - ✅ Substitutes correct paths in service file: - `WorkingDirectory` → detected project path - `User` → current user - `Group` → current user's group - `ExecStart` → detected Node.js path + src/index.js - `ReadWritePaths` → project directory - ✅ Copies service file to `/etc/systemd/system/` - ✅ Reloads systemd daemon - ✅ Enables service (auto-start on boot) - ✅ Optionally starts the service immediately - ✅ Shows service status and useful commands - ✅ Interactive prompts with confirmation - ✅ Colored output for better readability - ✅ Error handling and validation ### 2. `uninstall.sh` - Automated Uninstallation Script Features: - ✅ Stops the running service - ✅ Disables the service (won't start on boot) - ✅ Removes service file from `/etc/systemd/system/` - ✅ Reloads systemd daemon - ✅ Preserves project files and configuration - ✅ Interactive confirmation prompt - ✅ Clear status messages - ✅ Error handling ## 📖 Documentation Updated Updated `SYSTEMD.md` to include: - Quick installation section (recommended method) - Instructions for both automated and manual installation - Clear distinction between the two approaches ## 🚀 Usage ### Install the service: ```bash cd /home/claude/agent-manager ./install.sh ``` ### Uninstall the service: ```bash ./uninstall.sh ``` Both scripts are executable and ready to use. The install script will prompt for confirmation before making changes, and will ask if you want to start the service immediately after installation. ## ✨ Key Benefits 1. **Zero Configuration**: Scripts automatically detect all necessary paths and settings 2. **Safe**: Interactive prompts prevent accidental installation/removal 3. **Flexible**: Works in any directory, for any user 4. **Validated**: Checks prerequisites before proceeding 5. **User-Friendly**: Clear colored output and helpful messages 6. **Complete**: Handles the entire lifecycle from install to uninstall The scripts are production-ready and follow best practices for shell scripting with proper error handling and validation.
Szontágh Ferenc okomentoval 9 mesiacov pred
Vlastník

Push into the git repo

Push into the git repo
Claude Coding Agent okomentoval 9 mesiacov pred
Spolupracovník

Pushed to Git Repository

Successfully committed and pushed the systemd installation scripts to the repository!

Commit: 1f39dda Branch: main

Files added:

  • install.sh - Automated systemd service installation script
  • uninstall.sh - Automated systemd service removal script
  • SYSTEMD.md - Updated with installation instructions

The changes are now available in the remote repository at fszontagh/agent-manager.

✅ **Pushed to Git Repository** Successfully committed and pushed the systemd installation scripts to the repository! **Commit:** `1f39dda` **Branch:** `main` **Files added:** - ✅ `install.sh` - Automated systemd service installation script - ✅ `uninstall.sh` - Automated systemd service removal script - ✅ `SYSTEMD.md` - Updated with installation instructions The changes are now available in the remote repository at `fszontagh/agent-manager`.
Prihláste sa pre zapojenie do konverzácie.
Žiadny míľnik
Žiadny priradený
2 účastníkov
Načítavanie...
Zrušiť
Uložiť
Zatiaľ neexistuje žiadny obsah.