2023-05-12 02:18:29 +00:00
|
|
|
data_sync
|
|
|
|
|
2023-05-12 02:42:31 +00:00
|
|
|
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 or to wait
|
|
|
|
for ansible to finish installing the right backup software. 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.
|
2023-05-12 02:18:29 +00:00
|
|
|
|
|
|
|
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.
|