hubio-sync serve
Start the hubio-sync background scheduler daemon.
Synopsis
hubio-sync serve [flags]
Description
The serve command starts a background scheduler daemon that automatically runs migrations based on their configured cron expressions. The daemon loads configuration from the shared config file (same as the GUI) and executes scheduled migrations.
Flags
| Flag | Short | Description |
|---|---|---|
--daemon | -d | Run as background daemon (logs to file instead of stdout) |
Configuration
The daemon loads configuration from:
- macOS/Linux:
~/.config/hubio-sync/config.json - Windows:
%APPDATA%\hubio-sync\config.json
This is the same configuration used by the GUI, so schedules created in the GUI will be executed by the daemon.
Usage
Interactive Mode
Run the scheduler interactively with output to the terminal:
hubio-sync serve
Output:
hubio Sync Scheduler
====================
Version: 1.0.8
Mode: interactive
Loading configuration and starting scheduler...
Press Ctrl+C to stop...
Daemon Mode
Run as a background daemon with logs written to files:
hubio-sync serve --daemon
In daemon mode:
- Output goes to log files instead of stdout
- Suitable for running as a system service
- Logs are written to:
- macOS:
~/Library/Logs/hubio-sync/daemon.log - Linux:
~/.local/state/hubio-sync/logs/daemon.log - Windows:
%LOCALAPPDATA%\hubio-sync\logs\daemon.log
- macOS:
Signal Handling
The daemon handles the following signals:
| Signal | Action |
|---|---|
SIGTERM | Graceful shutdown |
SIGINT | Graceful shutdown (Ctrl+C) |
SIGHUP | Reload configuration |
Windows Service Integration
On Windows, when running as a Windows Service, the daemon automatically detects the service context and integrates with the Windows Service Control Manager (SCM).
Examples
Run Interactively
# Start scheduler in foreground
hubio-sync serve
# View output in terminal, Ctrl+C to stop
Run as Daemon
# Start in daemon mode
hubio-sync serve --daemon
Run via System Service
For production use, install as a system service:
# Install and start as system service
hubio-sync service install --start
# The service runs 'serve --daemon' automatically
Logs
View daemon logs:
# View logs via service command
hubio-sync service logs
# Follow logs in real-time
hubio-sync service logs -f
Or directly:
# macOS
tail -f ~/Library/Logs/hubio-sync/daemon.log
# Linux (systemd)
journalctl -u hubio-sync -f
# Linux (file)
tail -f ~/.local/state/hubio-sync/logs/daemon.log
# Windows (PowerShell)
Get-Content $env:LOCALAPPDATA\hubio-sync\logs\daemon.log -Wait
See Also
- CLI Reference
- service - Install as system service
- schedule - Manage schedules
- gui - Configure schedules via GUI