Skip to content

Instantly share code, notes, and snippets.

@macielti
Created August 13, 2023 15:19
Show Gist options
  • Select an option

  • Save macielti/98fcbabd882aba3ed78d5c3c567f23d7 to your computer and use it in GitHub Desktop.

Select an option

Save macielti/98fcbabd882aba3ed78d5c3c567f23d7 to your computer and use it in GitHub Desktop.
Backup routine Datalevin Babashka script
(require '[clojure.java.shell :refer [sh]])
(sh "docker" "exec" "global_datalevin" "dtlv" "-d" "/data/data" "copy" "/tmp/global_datalevin_backup")
(def timestamp (quot (System/currentTimeMillis) 1000))
(let [[save-backup-to-file-path] *command-line-args*]
(when (or (empty? save-backup-to-file-path))
(println "Usage: <save-backup-to-file-path>")
(System/exit 1))
(sh "docker" "cp" "global_datalevin:/tmp/global_datalevin_backup/data.mdb" (str save-backup-to-file-path "-" timestamp)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment