Namespace src/Backup

src/Backup

Overview

Directory src/Backup

file source src/Backup/dir.sh

Backup::dir

Backup given directory in the base directory or in BACKUP_DIR directory backup directory name is composed by following fields separated by _:

  • if BACKUP_DIR is not empty then escaped full dir name separated by @
  • date with format %Y%m%d_%H:%M:%S (Eg: 20240326_14:45:08)
  • .tgz extension
Arguments
  • $1 (string): the base directory
  • $2 (string): the directory to backup from base directory
Environment variables
  • BACKUP_DIR (String): variable referencing backup directory
  • FRAMEWORK_ROOT_DIR (String): used to remove this project directory from displayed backup path
  • SUDO (String): allows to use custom sudo prefix command
Exit codes
  • 1: if directory to backup does not exist, 0 if everything is OK
  • 2: on backup failure
Output on stderr
  • message about where the directory is backed up
Requires
  • Linux::requireTarCommand

src/Backup/file.sh

file source src/Backup/file.sh

Backup::file

Backup given file in the same directory or in BACKUP_DIR directory backup file name is composed by following fields separated by -:

  • if BACKUP_DIR is not empty then escaped dir name separated by @
  • filename(without path)
  • date with format %Y%m%d_%H:%M:%S (Eg: 20240326_14:45:08)
Arguments
  • $1 (file:String): the file to backup
Environment variables
  • SUDO (String): allows to use custom sudo prefix command
  • BACKUP_DIR (if): not set backup the file in the same directory as original file
Exit codes
  • 1: on copy failure
Output on stderr
  • messages about backup file location
Or, if you want, you can alternatively use the GitHub discussion Q&A for feedback and questions.