Auto-Start on Boot
Auto-Start on Boot
Section titled “Auto-Start on Boot”For always-on CI/CD, you’ll want your build agent to start automatically when your machine boots. FlightStack provides built-in commands to configure this.
Quick Setup
Section titled “Quick Setup”Install the agent as a startup service:
flightstack agent installRemove the startup service:
flightstack agent uninstallThat’s it! The CLI handles all platform-specific configuration.
Platform Details
Section titled “Platform Details”How It Works
Section titled “How It Works”On macOS, FlightStack uses launchd (Apple’s service management framework) to start the agent automatically.
Installation
Section titled “Installation”flightstack agent installThis creates a Launch Agent plist at:
~/Library/LaunchAgents/com.flightstack.agent.plistOutput:
Installing FlightStack Agent as startup service...
Created: ~/Library/LaunchAgents/com.flightstack.agent.plist
✓ Agent installed as startup service!
The agent will start automatically on login.
To start now: launchctl start com.flightstack.agentTo stop: launchctl stop com.flightstack.agentTo uninstall: flightstack agent uninstallManual Control
Section titled “Manual Control”# Start the service now (without rebooting)launchctl start com.flightstack.agent
# Stop the servicelaunchctl stop com.flightstack.agent
# Check if runninglaunchctl list | grep flightstackConfiguration
Section titled “Configuration”The generated plist includes:
- RunAtLoad: Starts when you log in
- KeepAlive: Restarts if the agent crashes
- StandardOutPath: Logs to
~/.flightstack/agent.log - StandardErrorPath: Errors to
~/.flightstack/agent.error.log
Uninstallation
Section titled “Uninstallation”flightstack agent uninstallThis stops the service and removes the plist file.
How It Works
Section titled “How It Works”On Linux, FlightStack uses systemd user services to manage the agent.
Installation
Section titled “Installation”flightstack agent installThis creates a systemd service at:
~/.config/systemd/user/flightstack-agent.serviceOutput:
Installing FlightStack Agent as startup service...
Created: ~/.config/systemd/user/flightstack-agent.service
✓ Agent installed as startup service!
The agent will start automatically on login.
To start now: systemctl --user start flightstack-agentTo stop: systemctl --user stop flightstack-agentTo view logs: journalctl --user -u flightstack-agent -fTo uninstall: flightstack agent uninstall
Enabled user lingering - agent will run even when logged out.Manual Control
Section titled “Manual Control”# Start the servicesystemctl --user start flightstack-agent
# Stop the servicesystemctl --user stop flightstack-agent
# Check statussystemctl --user status flightstack-agent
# View logsjournalctl --user -u flightstack-agent -fUser Lingering
Section titled “User Lingering”The install command enables “user lingering” which allows the service to run even when you’re not logged in:
loginctl enable-linger $USERThis is essential for headless build servers.
Configuration
Section titled “Configuration”The generated service file includes:
- Restart=on-failure: Auto-restart on crashes
- RestartSec=10: Wait 10 seconds before restart
- Logs to
~/.flightstack/agent.log
Uninstallation
Section titled “Uninstallation”flightstack agent uninstallThis stops and disables the service, then removes the service file.
How It Works
Section titled “How It Works”On Windows, FlightStack uses Task Scheduler to start the agent at login.
Installation
Section titled “Installation”flightstack agent installThis creates a scheduled task named FlightStackAgent.
Output:
Installing FlightStack Agent as startup service...
✓ Agent installed as startup service!
The agent will start automatically on logon.
To start now: schtasks /run /tn FlightStackAgentTo stop: flightstack agent stopTo uninstall: flightstack agent uninstallManual Control
Section titled “Manual Control”# Start the taskschtasks /run /tn FlightStackAgent
# View task infoschtasks /query /tn FlightStackAgent /v
# Stop the agentflightstack agent stopTask Scheduler GUI
Section titled “Task Scheduler GUI”You can also view and manage the task in Task Scheduler:
- Open Task Scheduler (
taskschd.msc) - Find “FlightStackAgent” in the task list
- Right-click to Run, Disable, or Delete
Configuration
Section titled “Configuration”The scheduled task is configured to:
- Run at logon
- Run with highest privileges
- Not stop if the computer switches to battery
Uninstallation
Section titled “Uninstallation”flightstack agent uninstallThis removes the scheduled task.
Verifying Installation
Section titled “Verifying Installation”After installation, verify the startup service is configured:
# Check if plist existsls -la ~/Library/LaunchAgents/com.flightstack.agent.plist
# Check if loadedlaunchctl list | grep flightstack# Check service statussystemctl --user status flightstack-agent
# Check if enabledsystemctl --user is-enabled flightstack-agent# Check task existsschtasks /query /tn FlightStackAgentTesting the Setup
Section titled “Testing the Setup”-
Install the service
Terminal window flightstack agent install -
Start it manually (to test without rebooting)
Terminal window launchctl start com.flightstack.agentTerminal window systemctl --user start flightstack-agentTerminal window schtasks /run /tn FlightStackAgent -
Verify it’s running
Terminal window flightstack agent status -
Check in FlightStack app
- Go to Build Agents
- Verify your agent shows as “Online”
-
Test reboot (optional)
- Restart your computer
- Verify agent starts automatically
Logs Location
Section titled “Logs Location”When running as a service, logs are written to:
| Platform | Log File |
|---|---|
| macOS | ~/.flightstack/agent.log |
| Linux | ~/.flightstack/agent.log or journalctl --user -u flightstack-agent |
| Windows | %USERPROFILE%\.flightstack\agent.log |
Troubleshooting
Section titled “Troubleshooting”Service Won’t Start
Section titled “Service Won’t Start”Check the logs for errors:
tail -100 ~/.flightstack/agent.logCommon issues:
- Agent not registered (run
flightstack agent registerfirst) - Invalid token (re-register the agent)
- Network issues (check connectivity)
Agent Not Registered
Section titled “Agent Not Registered”You must register the agent before installing as a service:
flightstack agent registerflightstack agent installPermission Issues (macOS)
Section titled “Permission Issues (macOS)”If you see permission errors:
# Ensure LaunchAgents directory existsmkdir -p ~/Library/LaunchAgents
# Check permissionsls -la ~/Library/LaunchAgents/Systemd Issues (Linux)
Section titled “Systemd Issues (Linux)”# Reload systemd after manual changessystemctl --user daemon-reload
# Check for errorsjournalctl --user -u flightstack-agent --no-pager -n 50Task Not Running (Windows)
Section titled “Task Not Running (Windows)”- Open Task Scheduler
- Find FlightStackAgent
- Check the “Last Run Result” column
- Right-click > Properties > check configuration
Updating
Section titled “Updating”When you update the FlightStack CLI, the startup service continues to work because it points to the executable. After updating:
- Stop the running agent
- Update the CLI
- Restart the agent (or reboot)
# Stopflightstack agent stop
# Update (example for Homebrew)brew upgrade flightstack
# Startflightstack agent startRemoving Auto-Start
Section titled “Removing Auto-Start”To stop the agent from starting automatically:
flightstack agent uninstallThis removes the startup configuration but keeps your agent registered. You can still start the agent manually with flightstack agent start.