Moved almost all logic into pure bash to avoid Rake SIGTERMS on long running backups.