diff --git a/.vscode/numbered-bookmarks.json b/.vscode/numbered-bookmarks.json index c4067aa..4c08963 100644 --- a/.vscode/numbered-bookmarks.json +++ b/.vscode/numbered-bookmarks.json @@ -1,19 +1,3 @@ { - "bookmarks": [ - { - "fsPath": "$ROOTPATH$/pilerBackup/pilerbackup.sh", - "bookmarks": [ - -1, - 113, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1 - ] - } - ] + "bookmarks": [] } \ No newline at end of file diff --git a/pilerBackup/pilerbackup.sh b/pilerBackup/pilerbackup.sh index 7c90f50..3bcff3e 100755 --- a/pilerBackup/pilerbackup.sh +++ b/pilerBackup/pilerbackup.sh @@ -13,6 +13,7 @@ export PATH=$PATH:/usr/local/bin ### text formatting presents if command -v tput > /dev/null; then + bold=$(tput bold) cyan=$(tput setaf 6) err=$(tput bold)$(tput setaf 1) magenta=$(tput setaf 5) @@ -22,6 +23,7 @@ if command -v tput > /dev/null; then width=$(tput cols) yellow=$(tput setaf 3) else + bold="" cyan="" err="" magenta="" @@ -112,71 +114,59 @@ exitError () { # display script help information scriptHelp () { - printf "\n${cyan}%s\n" "--------------------------------------------------------------------------------" - - printf "Usage:${norm} %s [parameters]\n\n" "$scriptName" - printf "${cyan}Parameters ${yellow}(default value):${norm}\n" - printf "There are NO mandatory parameters. If a parameter is not " - printf "supplied, it's\n" - printf "default value will be used. In the case of a switch parameter, " - printf "it will\n" - printf "remain deactivated if not specified.\n\n" - - printf "${magenta}script related\n" - printf "${cyan}-c, --config, --details${norm}\n" - printf "Path to the configuration key/value pair file for this script.\n" - printf "${yellow}(scriptPath/scriptName.details)${norm}\n\n" - printf "${cyan}-h, -?, --help${norm}\n" - printf "This help screen.\n\n" - printf "${cyan}-l, --log${norm}\n" - printf "Path to write log file.\n" - printf "${yellow}(scriptPath/scriptName.log)${norm}\n\n" - printf "${cyan}-v, --verbose${norm}\n" - printf "Log borg output with increased verbosity (list all files). " - printf "Careful! Your\n" - printf "log file can get large very quickly! This is a switch value, " - printf "specifying it\n" - printf "will turn the option ON.\n" - printf "${yellow}(normal output, option is OFF)${norm}\n\n" - - printf "${magenta}export options\n" - printf "${cyan}-a, --all${norm}\n" - printf "Export ALL email saved by piler. This is generally only useful " - printf "for an initial\n" - printf "backup. This is a switch parameter and WILL override specified " - printf "start/end dates.\n" - printf "${yellow}(option is OFF, use start/end dates)${norm}\n\n" - printf "${cyan}--start${norm}\n" - printf "Export email starting from this date (inclusive)\n" - printf "Date MUST be provided in the format 'YYYY.MM.DD'\n" - printf "${yellow}(Yesterday's date)${norm}\n\n" - printf "${cyan}--end${norm}\n" - printf "Export email ending at this date (inclusive)\n" - printf "Date MUST be provided in the format 'YYYY.MM.DD'\n" - printf "${yellow}(Yesterday's date)${norm}\n\n" - - printf "${magenta}503 functionality\n" - printf "${cyan}-5, --use-503${norm}\n" - printf "Copy an 'error 503' page to your webroot for your webserver to " - printf "find. This is a\n" - printf "switch value, specifying it will instruct the script to copy the " - printf "error page.\n" - printf "${yellow}(do NOT copy, option is OFF)${norm}\n\n" - printf "${cyan}--503-path${norm}\n" - printf "Path to the file you want copied to your webroot as the 'error " - printf "503' page during\n" - printf "backup operations.\n" - printf "${yellow}(scriptPath/503_backup.html)${norm}\n\n" - printf "${cyan}-w, --webroot${norm}\n" - printf "Path to where the 'error 503' file should be copied during " - printf "backups.\n" - printf "${yellow}(/usr/share/nginx/html)${norm}\n\n" - - printf "More details and examples of script usage can be found in the " - printf "repo wiki at\n" - printf "${yellow}https://git.asifbacchus.app/asif/pilerBackup/wiki${norm}\n" - - printf "${cyan}%s${norm}\n\n" "--------------------------------------------------------------------------------" + newline + printf "%sUsage: %s [parameters]%s\n\n" "$bold" "$scriptName" "$norm" + textblock "There are no mandatory parameters. If a parameter is not supplied, its default value will be used. In the case of a switch parameter, it will remain DEactivated by default." + newline + textblock "Parameters are listed then followed by a description of their effect on the following line. Finally, if a default value exists, it will be listed on the next line in (parentheses)." + newline + textblock "${magenta}--- script related ---${norm}" + newline + switchTextblock "-c | --config | --details" + textblock "Path to the configuration key/value pair file for this script." + defaultsTextblock "(scriptPath/scriptName.details)" + newline + switchTextblock "-h | -? | --help" + textblock "This help screen." + newline + switchTextblock "-l | --log" + textblock "Path to write log file." + defaultsTextblock "(scriptPath/scriptName.log)" + newline + switchTextblock "[SWITCH] -v | --verbose" + textblock "Log borg output with increased verbosity (list all files). Careful! Your log file can get very large very quickly!" + defaultsTextblock "(normal output, option is OFF)" + newline + textblock "${magenta}--- export options ---${norm}" + newline + switchTextblock "[SWITCH] -a | --all" + textblock "Export ALL email saved by piler. This is generally only useful for an initial backup. Setting this switch will override any specified start/end dates." + defaultsTextblock "(use start/end dates, option is OFF)" + newline + switchTextblock "--start" + textblock "Export email starting from this date (inclusive). Date MUST be provided in YYYY.MM.DD format." + defaultsTextblock "(yesterday's date)" + newline + switchTextblock "--end" + textblock "Export email ending at this date (inclusive). Date MUST be provided in YYYY.MM.DD format." + defaultsTextblock "(yesterday's date)" + newline + textblock "${magenta}--- 503 functionality ---${norm}" + newline + switchTextblock "[SWITCH] -5 | --use-503" + textblock "Copy an 'error 503' page/indicator file to your webroot for your webserver to find. Specifying this option will enable other 503 options." + defaultsTextblock "(do NOT copy, option is OFF)" + newline + switchTextblock "--503-path" + textblock "Path to the file you want copied to your webroot as the 'error 503' page." + defaultsTextblock "(scriptPath/503_backup.html)" + newline + switchTextblock "-w | --webroot" + textblock "Path to where the 'error 503' file should be copied." + defaultsTextblock "(/usr/share/nginx/html/)" + newline + textblock "More details and examples of script usage can be found in the repo wiki at ${yellow}https://git.asifbacchus.app/asif/pilerBackup/wiki${norm}" + newline } # generate dynamic timestamps