Skip to content

Running as a Service

Astonish runs as a background daemon managed by your operating system's service manager. The daemon serves Studio at http://localhost:9393, handles scheduled flows, channel integrations, and persistent sessions. It starts automatically on boot and restarts on failure.

Installation

The daemon install command registers Astonish with the appropriate service manager for your OS:

bash
astonish daemon install

This creates:

  • macOS: A launchd plist at ~/Library/LaunchAgents/dev.astonish.daemon.plist
  • Linux: A systemd user unit at ~/.config/systemd/user/astonish.service

Options

FlagDefaultDescription
--port9393HTTP port for Studio UI

Example with custom port:

bash
astonish daemon install --port 8080

Starting and Stopping

bash
# Start the daemon
astonish daemon start

# Stop the daemon
astonish daemon stop

# Restart the daemon
astonish daemon restart

# Check status
astonish daemon status

Running in Foreground

For debugging, run the daemon in the foreground instead of as a background service:

bash
astonish daemon run

This starts the server in the current terminal session with logs printed to stdout. Press Ctrl+C to stop.

FlagDefaultDescription
--port9393HTTP port for Studio UI

Controlling Auto-Start

The daemon is configured to start automatically on login by default.

macOS (launchd)

The plist includes RunAtLoad: true. To manually control:

bash
# Disable auto-start
launchctl bootout gui/$(id -u) ~/Library/LaunchAgents/dev.astonish.daemon.plist

# Re-enable
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/dev.astonish.daemon.plist

Linux (systemd)

The unit is enabled via systemctl --user. To manually control:

bash
# Disable auto-start
systemctl --user disable astonish

# Re-enable
systemctl --user enable astonish

Viewing Logs

bash
# Show recent logs (default: last 50 lines)
astonish daemon logs

# Follow live logs
astonish daemon logs -f

# Show last 100 lines
astonish daemon logs -n 100

OS-level log access

bash
# macOS: view via system log
log show --predicate 'subsystem == "dev.astonish.daemon"' --last 1h

# Linux: view via journalctl
journalctl --user -u astonish -f

Log files are also written to ~/.local/share/astonish/logs/.

Uninstalling

Remove the daemon registration:

bash
astonish daemon uninstall

This stops the service and removes the plist or systemd unit file.

All Daemon Subcommands

CommandDescription
daemon installRegister as a system service
daemon uninstallRemove the system service
daemon startStart the background service
daemon stopStop the background service
daemon restartRestart the background service
daemon statusShow current daemon status
daemon runRun in foreground (for debugging)
daemon logsView daemon logs

See Also