@@ -2581,24 +2581,30 @@ (if (and src-db dest-db) (if (file-exists? src-db) (if (file-exists? lockfile) (debug:print 0 *default-log-port* "Lock "lockfile" exists, skipping sync...") - (begin - (with-output-to-file lockfile - (lambda () - (print (current-process-id)))) - (debug:print-info 0 *default-log-port* "Attempting to sync data from "src-db" to "dest-db"...") - (if (not (file-exists? dest-db)) - (begin - (debug:print 0 *default-log-port* "Using copy to create "dest-db" from "src-db) - (file-copy src-db dest-db)) - (let ((res (dbmod:db-to-db-sync src-db dest-db 0 (dbfile:db-init-proc) keys))) - (if res - (debug:print-info 0 *default-log-port* "Synced " res " records from "src-db" to "dest-db) - (debug:print-info 0 *default-log-port* "No sync due to permissions or other issue.")))) - (delete-file* lockfile))) + (dbfile:with-simple-file-lock + lockfile + (lambda () + ;;(with-output-to-file lockfile + ;; (lambda () + ;; (print (current-process-id)))) + (debug:print-info 0 *default-log-port* "Attempting to sync data from "src-db" to "dest-db"...") + (if #f ;; (not (file-exists? dest-db)) + (begin + (dbfile:with-simple-file-lock + (conc dest-db ".lock") ;; is the db being opened right now? + (lambda () + (debug:print 0 *default-log-port* "Using copy to create "dest-db" from "src-db) + (file-copy src-db dest-db)))) + (let ((res (dbmod:db-to-db-sync src-db dest-db 0 (dbfile:db-init-proc) keys))) + (if res + (debug:print-info 0 *default-log-port* "Synced " res " records from "src-db" to "dest-db) + (debug:print-info 0 *default-log-port* "No sync due to permissions or other issue.")))) + ;; (delete-file* lockfile) + ))) (debug:print 0 *default-log-port* "No sync due to unreadble or non-existant source file"src-db)) (debug:print 0 *default-log-port* "Usage for -db2db; -to and -from must be specified")) (set! *didsomething* #t))) (if (args:get-arg "-list-test-time")