-
-
Notifications
You must be signed in to change notification settings - Fork 5
Watch Mode
Watch mode runs icloudpd-rs as a long-lived process, repeating the download cycle at a fixed interval.
# Sync every hour
icloudpd-rs -u my@email.address -d /photos --watch-with-interval 3600After completing a full download pass (enumerate → filter → download), the process sleeps for the specified number of seconds, then starts a new pass. This repeats indefinitely until stopped by a shutdown signal (Ctrl+C, SIGTERM, or SIGHUP).
Each cycle performs a full enumeration from the API. Assets already marked as downloaded in the state database are skipped.
Sending Ctrl+C, SIGTERM, or SIGHUP during a watch mode cycle will:
- Finish any in-flight downloads (partial
.partfiles are kept for resume) - Skip remaining queued downloads
- Exit cleanly
If the signal arrives during the sleep interval between cycles, the sleep is interrupted and the process exits immediately. A second signal at any point force-exits the process.
Albums are re-resolved at the start of each watch cycle. If you create a new album in iCloud, it will be discovered on the next cycle without restarting the daemon.
When a download cycle ends with partial failures (some files downloaded, some failed), watch mode logs a warning and continues to the next cycle instead of exiting. Transient failures are expected in long-running sessions - the next cycle retries failed assets automatically via the state database.
Only a complete failure (no files downloaded at all) causes the daemon to exit.
On Linux, use --notify-systemd to integrate with systemd's service manager. icloudpd-rs sends:
-
READY=1after authentication completes -
STATUS=with cycle progress updates -
STOPPING=1on shutdown -
WATCHDOG=1heartbeats (ifWatchdogSec=is configured)
Use --pid-file to write a PID file for service managers that need it.
[Unit]
Description=icloudpd-rs photo sync
After=network-online.target
[Service]
Type=notify
ExecStart=/usr/local/bin/icloudpd-rs \
--username my@email.address \
--directory /photos \
--watch-with-interval 3600 \
--notify-systemd \
--pid-file /run/icloudpd-rs.pid
Restart=on-failure
WatchdogSec=7200
[Install]
WantedBy=multi-user.target