Mount Watcher CLI to Auto Import
The starskymountwatchercli feature runs as a background watcher for mounted camera media. When a camera SD card (or similar storage) is connected, it can automatically trigger import.
This is useful when you want an always-on ingest flow without manually starting each import.
Overview
- Listens for mount events.
- Detects whether a mounted volume is likely camera storage.
- Starts import only for matching camera volumes.
- Supports installation as an OS service.
How camera detection works
The mount watcher uses the same camera-storage heuristics as the importer:
- Volume is ready and accessible.
- Filesystem is camera-friendly (for example FAT or exFAT variants).
- Camera folder structure is detected (for example
DCIMor similar patterns).
Only when checks pass, import starts.
CLI options
starskymountwatchercli --help
starskymountwatchercli --install
starskymountwatchercli --uninstall
starskymountwatchercli --status
Additional flags:
--helpor-hto print usage and platform-specific service notes.--appsettingspathor-asp— override the path toappsettings.json(setsapp__appsettingspath).--appsettingslocalpathor-aspl— override the path toappsettings.local.json.--connectionor-c— override the database connection string (setsapp__DatabaseConnection).--thumbnailtempfolderor-f— override the thumbnail temp folder path.--tempfolderor-tf— override the temp folder path.
Platform support
- macOS: launchd LaunchAgent install/uninstall flow.
- Linux: systemd service install/uninstall flow (with user-level fallback).
- Windows: Windows Service install/uninstall flow via
sc.exe.
Windows Desktop App integration
On the Windows desktop app (WPF), MountWatcher can be toggled without using the CLI directly:
- Open the app menu: Settings → Mount Watcher
- Click Enable Mount Watcher (requires admin)
- A Windows UAC consent prompt appears — approve it to install the service
- The submenu shows Status: Running once the service is active
To stop and remove the service, open the same submenu and click Disable Mount Watcher (another UAC prompt appears).
The preference is stored in %AppData%\starsky\settings.json (MountWatcherEnabled). When the app starts and the preference is enabled, it automatically reinstalls and starts the service. If installation fails (for example the binary is missing), the preference is cleared automatically so the app does not retry on every launch.
Note: The app itself does not run elevated. Only the
starskymountwatchercli.exesub-process is elevated for the duration of thesc.exe createorsc.exe deletecall.
Windows service paths
When the desktop app installs the Windows service, it bakes the user's AppData paths directly into the service command line. This means the service reads the correct appsettings.json, database, and temp folders even though it runs as LocalSystem without inheriting user environment variables.
The paths are resolved at install time from the installing user's profile:
| Arg | Path |
|---|---|
--connection | %APPDATA%\starsky\starsky.db |
--appsettingspath | %APPDATA%\starsky\appsettings.json |
--appsettingslocalpath | %APPDATA%\starsky\appsettings.local.json |
--thumbnailtempfolder | %APPDATA%\starsky\thumbnailTempFolder |
--tempfolder | %LOCALAPPDATA%\starsky\tempFolder |
Typical workflow
- Install and start the service.
- Insert an SD card or connect camera storage.
- Watcher receives mount event.
- Camera checks pass.
- Import starts automatically.
Operational notes
- macOS may require Full Disk Access for stable operation on external media.
- Linux logs are visible with
journalctlfor the mount watcher service. - Windows logs are available in Event Viewer.
Delete after import
When importing from mounted camera storage (for example via the mount watcher), Starsky can optionally delete the original files after a successful import.
Set the option in appsettings.json:
"ImportMountWatcher" : {
"DeleteAfter": "false"
}
Or override with an environment variable:
"app__ImportMountWatcher__DeleteAfter": "true"
When DeleteAfter is true, successfully imported files on the mounted device will be removed. Use this with caution — enable only when you want files removed from the source device after import.
macOS Desktop App integration
The macOS Starsky desktop app has built-in support for managing MountWatcher without using the command line.
Enable via the menu
Open the Starsky menu bar icon → MountWatcher → Enable MountWatcher.
The submenu shows the current state each time it opens:
| State | Menu shows |
|---|---|
| Disabled | "Enable MountWatcher" |
| Enabled, running | "Status: Running" + "Disable MountWatcher" |
| Enabled, not running | "Status: Not Running" + "Disable MountWatcher" |
Preference persistence
The enabled/disabled preference is stored in ~/Library/Application Support/starsky/settings.json. It survives app restarts and Sparkle automatic updates.
- On startup the app re-enables MountWatcher automatically if the preference is set.
- Before a Sparkle update replaces the app bundle, the app stops MountWatcher; the next launch re-enables it.
- If enabling fails (for example the CLI binary is missing), the preference is cleared and an error is shown.
macOS launchd paths
When the desktop app installs the launchd agent, the generated plist includes an EnvironmentVariables section so the service finds the correct appsettings, database, and temp folders without inheriting the app's environment.
| Variable | Path |
|---|---|
app__appsettingspath | ~/Library/Application Support/starsky/appsettings.json |
app__appsettingslocalpath | ~/Library/Application Support/starsky/appsettings.local.json |
app__databaseConnection | Data Source=~/Library/Application Support/starsky/starsky.db |
app__thumbnailTempFolder | ~/Library/Application Support/starsky/thumbnailTempFolder/ |
app__tempFolder | ~/Library/Caches/starsky/tempFolder/ |
Requirement
The starskymountwatchercli binary must be present in the app bundle's runtime directory (starsky.app/Contents/MacOS/runtime-starsky-osx-{arm64,x64}/). It is included automatically in release builds.