add backup.nu
parent
a5a7812fc8
commit
afaf55b0f1
27
backup.nu
27
backup.nu
|
|
@ -1,7 +1,28 @@
|
||||||
def call_restic [] {
|
def settings-db-path [] {
|
||||||
run-external "restic" "-r" "/Volumes/data/backup" "backup" ~/.ssh ~/.
|
$env.HOME | path join ".backup.db"
|
||||||
|
}
|
||||||
|
|
||||||
|
export def "include" [...paths:path] {
|
||||||
|
$paths | into sqlite (settings-db-path) --table_name includes
|
||||||
|
}
|
||||||
|
|
||||||
|
export def "rm include" [item:string@"list includes"] {
|
||||||
|
open (settings-db-path) | query db $"DELETE FROM includes WHERE value IS '($item)'"
|
||||||
|
}
|
||||||
|
|
||||||
|
export def "list includes" [] {
|
||||||
|
open (settings-db-path) | get includes.value | uniq
|
||||||
|
}
|
||||||
|
|
||||||
|
export def list [] {
|
||||||
|
^restic snapshots --json | from json
|
||||||
|
}
|
||||||
|
|
||||||
|
export def init [] {
|
||||||
|
^restic init
|
||||||
}
|
}
|
||||||
|
|
||||||
export def main [] {
|
export def main [] {
|
||||||
call_restic
|
let items = (list includes)
|
||||||
|
^restic backup $items
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue