data_sync: sync homedir to external storage.

This commit is contained in:
2023-05-11 19:18:29 -07:00
parent 7a4e7977c3
commit b9f69e4aa1
2 changed files with 261 additions and 0 deletions

31
cmd/data_sync/README Normal file
View File

@@ -0,0 +1,31 @@
data_sync
This is a tool I wrote primarily to sync my home directory to a backup drive plugged
into my laptop. This system is provisioned by Ansible, and the goal is to be able to
just copy my home directory back in the event of a failure without having lost a great
deal of work. Specifically, I use a Framework laptop with the 1TB storage module,
encrypted with LUKS, and run this twice daily (timed to correspond with my commute,
though that's not really necessary). It started off as a shell script, then I decided
to just write it as a program.
Usage: data_sync [-d path] [-l level] [-m path] [-nqsv]
[-t path]
-d path path to sync source directory
(default "~")
-l level log level to output (default "INFO"). Valid log
levels are DEBUG, INFO, NOTICE, WARNING, ERR,
CRIT, ALERT, EMERG. The default is INFO.
-m path path to sync mount directory
(default "/media/$USER/$(hostname -s)_data")
-n dry-run mode: only check paths and print files to
exclude
-q suppress console output
-s suppress syslog output
-t path path to sync target directory
(default "/media/$USER/$(hostname -s)_data/$USER")
-v verbose rsync output
data_sync rsyncs the tree at the sync source directory (-d) to the sync target
directory (-t); it checks the mount directory (-m) exists; the sync target
target directory must exist on the mount directory.