ElectricRCAircraftGuy / eRCaGuy_backup

Easily back up your files on any Linux system via a Bash rsync wrapper which supports dry-runs, include & exclude files, and nice logging.
GNU General Public License v3.0
1 stars 0 forks source link

Implement TODOs from the README: show deleted files; show files not just dirs in log; make rsync multi-threaded #1

Open ElectricRCAircraftGuy opened 1 year ago

ElectricRCAircraftGuy commented 1 year ago

Implement TODOs from the README:

  1. [ ] show deleted files
  2. [ ] show files not just dirs in log
  3. [ ] make rsync multi-threaded

See links and ideas in the TODOs in the README to get started.

ElectricRCAircraftGuy commented 1 year ago

From man xargs: https://man7.org/linux/man-pages/man1/xargs.1.html:

-P max-procs, --max-procs=max-procs
              Run up to max-procs processes at a time; the default is 1.
              If max-procs is 0, xargs will run as many processes as
              possible at a time.  Use the -n option or the -L option
              with -P; otherwise chances are that only one exec will be
              done.  While xargs is running, you can send its process a
              SIGUSR1 signal to increase the number of commands to run
              simultaneously, or a SIGUSR2 to decrease the number.  You
              cannot increase it above an implementation-defined limit
              (which is shown with --show-limits).  You cannot decrease
              it below 1.  xargs never terminates its commands; when
              asked to decrease, it merely waits for more than one
              existing command to terminate before starting another.

              Please note that it is up to the called processes to
              properly manage parallel access to shared resources.  For
              example, if more than one of them tries to print to
              stdout, the output will be produced in an indeterminate
              order (and very likely mixed up) unless the processes
              collaborate in some way to prevent this.  Using some kind
              of locking scheme is one way to prevent such problems.  In
              general, using a locking scheme will help ensure correct
              output but reduce performance.  If you don't want to
              tolerate the performance difference, simply arrange for
              each process to produce a separate output file (or
              otherwise use separate resources).

So, use separate log files! Output them to a common dir. Make the log file names simple. Put the date in the log file dir. Cat them together and sort them when done. The timestamps in the files will intermingle the contents back together.

3 main log files now:

  1. Stdout
  2. Stderr
  3. Rsync_logfile