Skip to content

Background Daemon

jolt includes a background daemon that collects battery and power data even when the TUI isn’t running. This enables historical tracking and analysis over time.

  • Continuous monitoring — Collect data 24/7
  • Historical analysis — Track trends over days/weeks
  • Low overhead — Minimal resource usage
  • TUI integration — Seamless data sharing with the TUI
Terminal window
jolt daemon start

The daemon runs in the background and automatically starts collecting data.

For debugging or testing:

Terminal window
jolt daemon start --foreground
# or use the short option
jolt daemon start -f

Press Ctrl+C to stop.

Terminal window
jolt daemon stop
Terminal window
jolt daemon status

Shows:

  • Running state
  • PID
  • Uptime
  • Data collection stats
  • Last sample time
Terminal window
# Show recent logs (last 50 lines)
jolt logs
# Show specific number of lines
jolt logs --lines 100
# Follow logs in real-time
jolt logs --follow

Install a LaunchAgent:

Terminal window
jolt daemon install

This creates a LaunchAgent that starts the daemon automatically when you log in.

If a LaunchAgent already exists, use --force to overwrite it:

Terminal window
jolt daemon install --force

Use systemd to run on login:

Terminal window
# Create user service
mkdir -p ~/.config/systemd/user
cat > ~/.config/systemd/user/jolt-daemon.service << 'EOF'
[Unit]
Description=Jolt Battery Monitor Daemon
After=graphical-session.target
[Service]
ExecStart=%h/.local/bin/jolt daemon start --foreground
Restart=on-failure
[Install]
WantedBy=default.target
EOF
# Enable and start
systemctl --user enable jolt-daemon
systemctl --user start jolt-daemon

macOS:

Terminal window
jolt daemon uninstall

Linux:

Terminal window
systemctl --user disable jolt-daemon
systemctl --user stop jolt-daemon
rm ~/.config/systemd/user/jolt-daemon.service

Daemon settings in config file:

macOS: ~/Library/Application Support/jolt/config.toml Linux: ~/.config/jolt/config.toml

[daemon]
# Enable daemon functionality
enabled = true
# Sample interval in seconds
sample_interval = 60
# Socket path for IPC (macOS: ~/Library/Caches/jolt/daemon.sock, Linux: ~/.local/share/jolt/daemon.sock)
socket_path = "auto"

Controls how often the daemon records data:

IntervalStorage/DayUse Case
30s~2.8 MBDetailed analysis
60s~1.4 MBDefault, balanced
120s~0.7 MBLong-term storage
300s~0.3 MBMinimal overhead
[daemon]
sample_interval = 60

The daemon stores data in SQLite:

macOS:

~/Library/Caches/jolt/history.db

Linux:

~/.local/share/jolt/history.db
Terminal window
# View storage usage
jolt history summary
# Prune old data
jolt history prune --older-than 30

When the daemon is running, the TUI automatically:

  • Connects via IPC socket
  • Displays daemon status in the UI
  • Uses daemon data for extended history
  • Shows daemon stats in About dialog

Press d in the TUI to view daemon status.

  1. Check if already running:

    Terminal window
    jolt daemon status
  2. Check logs for errors:

    Terminal window
    jolt logs
  3. Try foreground mode for debugging:

    Terminal window
    jolt daemon start --foreground

Increase the sample interval:

[daemon]
sample_interval = 120

If TUI can’t connect to daemon:

  1. Verify daemon is running:

    Terminal window
    jolt daemon status
  2. Check socket file exists:

    macOS:

    Terminal window
    ls ~/Library/Caches/jolt/daemon.sock

    Linux:

    Terminal window
    ls ~/.local/share/jolt/daemon.sock
  3. Restart daemon:

    Terminal window
    jolt daemon stop && jolt daemon start
  1. Wait for at least one sample interval
  2. Check daemon logs for errors
  3. Verify history is enabled:
    Terminal window
    jolt config | grep history