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:
astonish daemon installThis creates:
- macOS: A launchd plist at
~/Library/LaunchAgents/dev.astonish.daemon.plist - Linux: A systemd user unit at
~/.config/systemd/user/astonish.service
Options
| Flag | Default | Description |
|---|---|---|
--port | 9393 | HTTP port for Studio UI |
Example with custom port:
astonish daemon install --port 8080Starting and Stopping
# Start the daemon
astonish daemon start
# Stop the daemon
astonish daemon stop
# Restart the daemon
astonish daemon restart
# Check status
astonish daemon statusRunning in Foreground
For debugging, run the daemon in the foreground instead of as a background service:
astonish daemon runThis starts the server in the current terminal session with logs printed to stdout. Press Ctrl+C to stop.
| Flag | Default | Description |
|---|---|---|
--port | 9393 | HTTP 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:
# 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.plistLinux (systemd)
The unit is enabled via systemctl --user. To manually control:
# Disable auto-start
systemctl --user disable astonish
# Re-enable
systemctl --user enable astonishViewing Logs
# 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 100OS-level log access
# macOS: view via system log
log show --predicate 'subsystem == "dev.astonish.daemon"' --last 1h
# Linux: view via journalctl
journalctl --user -u astonish -fLog files are also written to ~/.local/share/astonish/logs/.
Uninstalling
Remove the daemon registration:
astonish daemon uninstallThis stops the service and removes the plist or systemd unit file.
All Daemon Subcommands
| Command | Description |
|---|---|
daemon install | Register as a system service |
daemon uninstall | Remove the system service |
daemon start | Start the background service |
daemon stop | Stop the background service |
daemon restart | Restart the background service |
daemon status | Show current daemon status |
daemon run | Run in foreground (for debugging) |
daemon logs | View daemon logs |
See Also
- Deployment Overview — choosing between local and cloud deployment
- Kubernetes Deployment — cloud deployments use Kubernetes instead of the daemon