Schedule

sproutpal runs and exits, so each schedule is a oneshot service plus a timer. A timer never starts a run while the previous one is still going, output goes to the journal, and Persistent=true catches up on a run missed while the machine was off.

The .deb and .rpm packages install these user units in /usr/lib/systemd/user/:

Unit Schedule Command Typical run
sproutpal.timer Hourly, 9:00-17:00, Monday to Friday --sync (new media only) about 1 minute
sproutpal-full.timer Sunday 04:00 --sync --update --full about 5 minutes

The weekly full run also refreshes descriptions (for example comments added after a photo was uploaded) and tags media that the hourly runs skipped.

Turn it on

1. Put your settings in ~/.config/sproutpal/sproutpal.env, then edit the file (see Usage):

mkdir -p ~/.config/sproutpal
install -m 600 /usr/share/doc/sproutpal/sproutpal.env.example ~/.config/sproutpal/sproutpal.env

2. Run the service once by hand and check that it ends with success:

systemctl --user start sproutpal.service
systemctl --user show sproutpal.service -p Result

3. Turn on the timers:

systemctl --user enable --now sproutpal.timer sproutpal-full.timer

4. Turn on lingering, once per machine. Without it, user timers only run while you are logged in:

sudo loginctl enable-linger $USER

The units

sproutpal.service:

[Unit]
Description=sproutpal: sync new SproutAbout media into Immich
Wants=network-online.target
After=network-online.target

[Service]
Type=oneshot
EnvironmentFile=%h/.config/sproutpal/sproutpal.env
ExecStart=/usr/bin/sproutpal --sync
TimeoutStartSec=30min
Nice=10

sproutpal.timer:

[Unit]
Description=Run sproutpal hourly on weekdays, 9:00-17:00 (new media only)

[Timer]
OnCalendar=Mon..Fri *-*-* 09..17:00:00
RandomizedDelaySec=5min
Persistent=true

[Install]
WantedBy=timers.target

sproutpal-full.service is the same as sproutpal.service with ExecStart=/usr/bin/sproutpal --sync --update --full and TimeoutStartSec=2h. sproutpal-full.timer uses OnCalendar=Sun *-*-* 04:00:00.

Without a package, copy the four files from packaging/systemd/ in the .tar.gz to ~/.config/systemd/user/ and run systemctl --user daemon-reload.

Change the schedule or the options

To override a packaged unit, run systemctl --user edit --full sproutpal.timer (or sproutpal.service, for example to add --gps LAT,LON). Check a new schedule before you use it:

systemd-analyze calendar --iterations=10 "Mon..Fri *-*-* 09..17:00:00"
Schedule OnCalendar=
Hourly, 9:00-17:00, weekdays Mon..Fri *-*-* 09..17:00:00
Every 30 minutes, 9:00-17:30, weekdays Mon..Fri *-*-* 09..17:00,30:00
Hourly, every day hourly
Daily at 18:00 *-*-* 18:00:00
Weekly, Sunday 04:00 Sun *-*-* 04:00:00

Check on it

systemctl --user list-timers 'sproutpal*'
journalctl --user -u sproutpal -u sproutpal-full --since today

A run with skip lines and a line such as 14 media unavailable on SproutAbout were skipped is normal: those files are gone on SproutAbout's side. A unit with Result=exit-code had real failures; the journal names each one.