From 415f3292299145efb60a8170ccc62763a2403758 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Tue, 21 May 2019 17:27:10 -0600 Subject: [PATCH] new posix backup script -- skeleton --- backup_new.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 backup_new.sh diff --git a/backup_new.sh b/backup_new.sh new file mode 100755 index 0000000..a298f77 --- /dev/null +++ b/backup_new.sh @@ -0,0 +1,48 @@ +#!/bin/sh + +####### +### Backup Seafile/Seafile Pro server on bare-metal (NOT DOCKER) +####### + + +### text formatting presents +norm="\e[0m" +bold="\e[1m" +err="\e[1;31m" +warn="\e[1;93m" +ok="\e[32m" +yellow="\e[93m" +cyan="\e[96m" +mag="\e[95m" + + +### functions + +# generate dynamic timestamps +stamp () { + (date +%F" "%T) +} + +### end of functions + + +### default variable values + +# store logfile in the same directory as this script file using the same file +# name as the script but with the extension '.log' +scriptPath="$( CDPATH= cd -- "$( dirname -- "$0" )" && pwd -P )" +scriptName="$( basename "$0" )" +logFile="$scriptPath/${scriptName%.*}.log" + + +### start logging +printf "${mag}[%s] --- Start %s execution ---${norm}\n" \ + "$(stamp)" "$scriptName" >> "$logFile" +printf "${cyan}[%s] -- [INFO] Log located at ${yellow}%s${cyan} --${norm}\n" \ + "$(stamp)" "$logFile" >> "$logFile" + + + + + +exit 0 \ No newline at end of file