diff --git a/cmd/satoru/backup_job.go b/cmd/satoru/backup_job.go index 6417b01..be95e68 100644 --- a/cmd/satoru/backup_job.go +++ b/cmd/satoru/backup_job.go @@ -218,10 +218,9 @@ func remotePathType(ctx context.Context, site store.Site, path string) (string, func pullSQLiteTarget(ctx context.Context, jobID int64, site store.Site, target store.SiteTarget, stageDir string) error { tmpBase := fmt.Sprintf("/tmp/satoru-backup-%d-%s.sqlite3", jobID, shortHash(target.Path)) - quotedDB := shellQuote(target.Path) quotedTmp := shellQuote(tmpBase) remoteCmd := strings.Join([]string{ - sqliteBackupCommand(quotedDB, quotedTmp), + sqliteBackupCommand(target.Path, quotedTmp), fmt.Sprintf("gzip -f -- %s", quotedTmp), }, " && ") if err := sshCheck(ctx, site, remoteCmd); err != nil { diff --git a/cmd/satoru/jobs.go b/cmd/satoru/jobs.go index 398b042..f6311b9 100644 --- a/cmd/satoru/jobs.go +++ b/cmd/satoru/jobs.go @@ -238,7 +238,7 @@ func sqlitePreflightCheck(ctx context.Context, site store.Site, dbPath string) e "sqlite3 --version >/dev/null", "[ -r " + quoted + " ]", "tmp=$(mktemp /tmp/satoru-preflight.XXXXXX)", - sqliteBackupCommand(quoted, "$tmp"), + sqliteBackupCommand(dbPath, "$tmp"), "rm -f -- \"$tmp\"", }, " && ") return sshCheck(ctx, site, cmd) diff --git a/cmd/satoru/sqlite_backup.go b/cmd/satoru/sqlite_backup.go index 519f779..f3f41cf 100644 --- a/cmd/satoru/sqlite_backup.go +++ b/cmd/satoru/sqlite_backup.go @@ -7,12 +7,13 @@ const ( sqliteBackupTimeoutMS = 5000 ) -func sqliteBackupCommand(quotedDBPath, quotedBackupPath string) string { +func sqliteBackupCommand(dbPath, quotedBackupPath string) string { + readonlyURI := shellQuote("file:" + dbPath + "?mode=ro") return fmt.Sprintf( - "ok=0; for i in $(seq 1 %d); do sqlite3 -cmd \".timeout %d\" %s \".backup %s\" && ok=1 && break; sleep 1; done; [ \"$ok\" -eq 1 ]", + "ok=0; for i in $(seq 1 %d); do sqlite3 -readonly -cmd \".timeout %d\" %s \".backup %s\" && ok=1 && break; sleep 1; done; [ \"$ok\" -eq 1 ]", sqliteBackupRetryCount, sqliteBackupTimeoutMS, - quotedDBPath, + readonlyURI, quotedBackupPath, ) } diff --git a/internal/webui/dashboard.go b/internal/webui/dashboard.go index e4323d4..f658e03 100644 --- a/internal/webui/dashboard.go +++ b/internal/webui/dashboard.go @@ -262,7 +262,7 @@ func Dashboard(data DashboardData) templ.Component {

Satoru

-

Managed Sites Overview

+

Manage Backups

Signed in as %s (%s).