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.
Why Use the Daemon?
Section titled “Why Use the Daemon?”- 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
Starting the Daemon
Section titled “Starting the Daemon”Basic Start
Section titled “Basic Start”jolt daemon startThe daemon runs in the background and automatically starts collecting data.
Foreground Mode
Section titled “Foreground Mode”For debugging or testing:
jolt daemon start --foreground# or use the short optionjolt daemon start -fPress Ctrl+C to stop.
Stopping the Daemon
Section titled “Stopping the Daemon”jolt daemon stopChecking Status
Section titled “Checking Status”jolt daemon statusShows:
- Running state
- PID
- Uptime
- Data collection stats
- Last sample time
Viewing Logs
Section titled “Viewing Logs”# Show recent logs (last 50 lines)jolt logs
# Show specific number of linesjolt logs --lines 100
# Follow logs in real-timejolt logs --followAuto-Start on Login
Section titled “Auto-Start on Login”Install a LaunchAgent:
jolt daemon installThis creates a LaunchAgent that starts the daemon automatically when you log in.
If a LaunchAgent already exists, use --force to overwrite it:
jolt daemon install --forceUse systemd to run on login:
# Create user servicemkdir -p ~/.config/systemd/usercat > ~/.config/systemd/user/jolt-daemon.service << 'EOF'[Unit]Description=Jolt Battery Monitor DaemonAfter=graphical-session.target
[Service]ExecStart=%h/.local/bin/jolt daemon start --foregroundRestart=on-failure
[Install]WantedBy=default.targetEOF
# Enable and startsystemctl --user enable jolt-daemonsystemctl --user start jolt-daemonUninstall
Section titled “Uninstall”macOS:
jolt daemon uninstallLinux:
systemctl --user disable jolt-daemonsystemctl --user stop jolt-daemonrm ~/.config/systemd/user/jolt-daemon.serviceConfiguration
Section titled “Configuration”Daemon settings in config file:
macOS: ~/Library/Application Support/jolt/config.toml
Linux: ~/.config/jolt/config.toml
[daemon]# Enable daemon functionalityenabled = true
# Sample interval in secondssample_interval = 60
# Socket path for IPC (macOS: ~/Library/Caches/jolt/daemon.sock, Linux: ~/.local/share/jolt/daemon.sock)socket_path = "auto"Sample Interval
Section titled “Sample Interval”Controls how often the daemon records data:
| Interval | Storage/Day | Use Case |
|---|---|---|
| 30s | ~2.8 MB | Detailed analysis |
| 60s | ~1.4 MB | Default, balanced |
| 120s | ~0.7 MB | Long-term storage |
| 300s | ~0.3 MB | Minimal overhead |
[daemon]sample_interval = 60Data Storage
Section titled “Data Storage”The daemon stores data in SQLite:
macOS:
~/Library/Caches/jolt/history.dbLinux:
~/.local/share/jolt/history.dbStorage Management
Section titled “Storage Management”# View storage usagejolt history summary
# Prune old datajolt history prune --older-than 30TUI Integration
Section titled “TUI Integration”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.
Troubleshooting
Section titled “Troubleshooting”Daemon Won’t Start
Section titled “Daemon Won’t Start”-
Check if already running:
Terminal window jolt daemon status -
Check logs for errors:
Terminal window jolt logs -
Try foreground mode for debugging:
Terminal window jolt daemon start --foreground
High CPU Usage
Section titled “High CPU Usage”Increase the sample interval:
[daemon]sample_interval = 120Connection Issues
Section titled “Connection Issues”If TUI can’t connect to daemon:
-
Verify daemon is running:
Terminal window jolt daemon status -
Check socket file exists:
macOS:
Terminal window ls ~/Library/Caches/jolt/daemon.sockLinux:
Terminal window ls ~/.local/share/jolt/daemon.sock -
Restart daemon:
Terminal window jolt daemon stop && jolt daemon start
Data Not Appearing
Section titled “Data Not Appearing”- Wait for at least one sample interval
- Check daemon logs for errors
- Verify history is enabled:
Terminal window jolt config | grep history