Skip to content

Commit 63e5fbf

Browse files
committed
fix(backup): pin HOME=/root in restic env to keep the cache across runs
systemd services boot with a minimal env — restic warns "neither \$XDG_CACHE_HOME nor \$HOME are defined" and re-fetches the R2 index every run instead of using a persistent cache. Add HOME='/root' to the EnvironmentFile so restic can cache under /root/.cache/restic between the daily runs.
1 parent 0a018eb commit 63e5fbf

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/cli/commands/backup.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ function buildBackupEnv(
127127
if (strategy === 'restic') {
128128
if (creds.resticPassword) lines.push(`RESTIC_PASSWORD='${creds.resticPassword}'`);
129129
if (creds.resticRepository) lines.push(`RESTIC_REPOSITORY='${creds.resticRepository}'`);
130+
// systemd services boot with a minimal env — restic warns "neither
131+
// $XDG_CACHE_HOME nor $HOME are defined" and re-fetches R2 indexes every
132+
// run without a persistent cache. Pinning HOME lets restic cache under
133+
// /root/.cache/restic across runs.
134+
lines.push(`HOME='/root'`);
130135
}
131136
if (db && db.type !== 'sqlite') {
132137
lines.push(`DB_TYPE='${db.type}'`);

0 commit comments

Comments
 (0)