diff --git a/backup.sh b/backup.sh old mode 100644 new mode 100755 index 096bb6d..3cd0842 --- a/backup.sh +++ b/backup.sh @@ -19,67 +19,83 @@ note="\e[95m" ### scriptHelp -- display usage information for this script function scriptHelp { echo -e "${bold}${note}\n${scriptName} usage instructions:\n${normal}" - echo -e "${default}This script performs a backup of your Seafile system" - echo -e "assuming a fairly standard baremetal set up such as outlined at" - echo -e "${lit}https://mytechiethoughts.com${default}. Full details about" - echo -e "this script can be found at that site." + echo -e "${default}This script performs a backup of your Seafile system" \ + "assuming a fairly standard" + echo -e "baremetal set up such as outlined at${lit}" \ + "https://mytechiethoughts.com${default}." + echo -e "Details about this script can be found at that site." echo -e "${bold}\nThe script performs the following tasks:" \ "${normal}${default}" echo -e "1. Stops Seafile services and copies a 503 error page to" \ - "your webroot" - echo -e "\tto prevent access during backup." - echo -e "2. Dumps SQL to a temporary directory." - echo -e "3. Invokes borgbackup to backup your SQL info, Seafile program" - echo -e "and data files" - echo -e "\talong with any other files you specify." + "your webroot to" + echo -e "\tprevent access to Seafile during the backup." + echo -e "2. Dumps Seafile SQL database to a temporary directory." + echo -e "3. Invokes borgbackup to backup your SQL data, Seafile program" \ + "and data files," + echo -e "\tand any other files you specify." echo -e "3. Prunes old backups from borgbackup repo." - echo -e "4. Removes 503 page and cleans up." - echo -e "\nThe readme file included in this script's git contains detailed" - echo -e "usage information. The following is a brief summary:\n" + echo -e "4. Removes 503 error page, if necessary, and cleans up." + echo -e "\nThe readme file included in this script's git repo contains" \ + "detailed usage" + echo -e "information. The following is a brief summary:\n" echo -e "${bold}${note}Mandatory parameters:${normal}${default}" echo -e "${lit}\n-d, Seafile data directory${default}" echo -e "This is the physical location of your Seafile data." echo -e "${lit}\n-u, Seafile system user account${default}" - echo -e "The system account Seafile is running under. Some actions must" - echo -e "run as this user due to file ownership restrictions." + echo -e "The system account Seafile is running under. Some actions must" \ + "run as this" + echo -e "user due to file ownership restrictions." echo -e "${bold}${note}\nOptional parameters:${normal}${default}" echo -e "${lit}\n-5, Location of 503 error page file${default}" - echo -e "FULL PATH to the 503 error page HTML file you want copied to your" - echo -e "webroot to inform users the server is down during the backup. If" - echo -e "you don't specify a path/file, the default will be used. If the" - echo -e "default cannot be found, a warning will be logged and the script" - echo -e "will continue." + echo -e "FULL PATH to the 503 error page HTML file you want copied to" \ + "your webroot to" + echo -e "inform users the server is down during the backup. If you don't" \ + "specify a path/" + echo -e "file, the default will be used. If the default cannot be found," \ + "a warning will" + echo -e "be logged and the script will continue." echo -e "${info}Default: ScriptPath/503.html${default}" echo -e "${lit}\n-b, Location of file with borg repo details${default}" - echo -e "FULL PATH to the plain text file containing all information needed" - echo -e "to connect and process your borg repo. Details on the structure of" - echo -e "this file are in the readme and on ${lit}https://mytechiethoughts.com${default}" + echo -e "FULL PATH to the plain text file containing all information" \ + "needed to connect" + echo -e "and process your borg repo. Details on the structure of this" \ + "file are in the" + echo -e "readme and on ${lit}https://mytechiethoughts.com${default}" echo -e "${info}Default: ScriptPath/nc_borg.details${default}" echo -e "${lit}\n-l, Location to save log file${default}" - echo -e "This script writes a detailed log file of all activities. It is" - echo -e "structured in an way easy for log parsers (like Logwatch) to read." + echo -e "This script writes a detailed log file of all activities. It" \ + "is structured in" + echo -e "a way easy for log parsers (like Logwatch) to read." echo -e "${info}Default: ScriptPath/ScriptName.log${default}" echo -e "${lit}\n-s, Location of file with mySQL details${default}" - echo -e "FULL PATH to the plain text file containing all information needed" - echo -e "to connect to your mySQL (mariaDB) server and Seafile database." - echo -e "Details on the structure of this file are in the readme and on" - echo -e "${lit}https://mytechiethoughts.com${default}" + echo -e "FULL PATH to the plain text file containing all information" \ + "needed to connect" + echo -e "to your mySQL (mariaDB) server and Seafile database. Details" \ + "on the structure" + echo -e "of this file are in the readme and on${lit}" \ + "https://mytechiethoughts.com${default}" echo -e "${info}Default: ScriptPath/nc_sql.details${default}" echo -e "${lit}\n-v, Verbose output from borgbackup${default}" - echo -e "By default, this script will only log summary data from borg." - echo -e "If you need/want more detailed information, the verbose setting" - echo -e "will list every file processed along with their status. Note: Your" - echo -e "log file can quickly get very very large using this option!" + echo -e "By default, this script will only log summary data from borg." \ + "If you need/want" + echo -e "more detailed information, the verbose setting will list every" \ + "file processed" + echo -e "along with their status. Note: Your log file can quickly get" \ + "very very large" + echo -e "using this option!" echo -e "${info}Default: NOT activated (standard logging)${default}" echo -e "${lit}\n-w, webserver's webroot directory${default}" - echo -e "This is the location from which your webserver (NGINX, Apache," - echo -e "etc.) physically stores files to be served. This is NOT the" - echo -e "configuration directory for your webserver! It is the place" - echo -e "where the actual HTML/PHP/CSS/JS/etc. files are stored." - echo -e "NOTE: If you omit this option, then the entire 503 copy process" - echo -e "will be skipped regardless of the presence of a 503.html file." - echo -e "If you don't want to use the 503 feature, omitting this is an easy" - echo -e "way to skip it!" + echo -e "This is the location from which your webserver (NGINX, Apache," \ + "etc.) physically" + echo -e "stores files to be served. This is NOT the configuration" \ + "directory for your" + echo -e "webserver! It is the place where the actual" \ + "HTML/PHP/CSS/JS/etc. files are" + echo -e "stored. NOTE: If you omit this option, then the entire 503 copy" \ + "process will" + echo -e "be skipped regardless of the presence of a 503.html file. If" \ + "you don't want to" + echo -e "use the 503 feature, omitting this is an easy way to skip it!" echo -e "${info}Default: NONE${default}" echo -e "${lit}\n-?, This help screen${default}\n" echo -e "${bold}Please refer to the readme file and/or ${lit}https://mytechiethoughts.com${default}"