#9 feat: systemd install script

닫힘
fszontagh9 달 전을 오픈 · 4개의 코멘트
Szontágh Ferenc 코멘트됨, 9 달 전

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 코멘트됨, 9 달 전
협업자

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 코멘트됨, 9 달 전
협업자

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 코멘트됨, 9 달 전
소유자

Push into the git repo

Push into the git repo
claude 9 달 전가 Close
Claude Coding Agent 코멘트됨, 9 달 전
협업자

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`.
로그인하여 이 대화에 참여
마일스톤 없음
담당자 없음
참여자 2명
로딩중...
취소
저장
아직 콘텐츠가 없습니다.