Service Management

Overview

The Fenwave Agent can run in two modes:

  • Foreground mode โ€” Runs in your terminal, prints logs directly, stops when you close the terminal
  • Background mode (daemon) โ€” Runs silently in the background, persists after closing the terminal

Foreground Mode

Best for one-off use, debugging, or checking what the agent is doing:

fenwave service run

Press Ctrl+C to stop.

Custom port

fenwave service run --port 3005

Background Mode (Daemon)

Best for everyday use:

fenwave service start

The agent runs silently in the background. Close your terminal โ€” the agent keeps running.

Daemon Commands

Command Description
fenwave service start Start the agent in the background
fenwave service stop Stop the running agent
fenwave service restart Stop and restart the agent
fenwave service status Show current status (running, port, uptime)
fenwave service logs View agent logs
fenwave service start --port 3005         # Start on a specific port
fenwave service logs -f                    # Follow logs in real time
fenwave service logs --tail 50             # Show last 50 lines

Before Starting

The agent checks a few things before it will start:

  1. You are authenticated to Fenwave
  2. Your session has not expired
  3. Your device is registered
  4. Docker is running

If any of these fail, youโ€™ll see a clear message explaining what to fix.

Shutting Down

The agent always shuts down cleanly:

  • It notifies the DevApp dashboard (which will reconnect automatically once the agent restarts)
  • It waits for any active operations to finish before closing
  • It stops the DevApp container

Shutdown is triggered by fenwave service stop, Ctrl+C (foreground), or when your session expires.

Log Management

Agent logs are written to ~/.fenwave/logs/:

File Content
agent.log Full activity log
agent.error.log Errors only

Logs rotate automatically when a file reaches 10 MB (keeps up to 5 archives).

fenwave service logs               # View recent logs
fenwave service logs -f            # Follow in real time
fenwave service logs --tail 100    # Last 100 lines