Compare commits
No commits in common. "bbbdf38dcc0791ea1ed5aaa2aa3250edec1cc388" and "b371e18ab0fedaf192f8148d40f5adc354f7bb94" have entirely different histories.
bbbdf38dcc
...
b371e18ab0
75
.gitattributes
vendored
75
.gitattributes
vendored
@ -1,75 +0,0 @@
|
|||||||
# Common settings that generally should always be used with your language specific settings
|
|
||||||
|
|
||||||
# Auto detect text files and perform LF normalization
|
|
||||||
# https://www.davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/
|
|
||||||
* text=auto
|
|
||||||
|
|
||||||
#
|
|
||||||
# The above will handle all files NOT found below
|
|
||||||
#
|
|
||||||
|
|
||||||
# Documents
|
|
||||||
*.bibtex text diff=bibtex
|
|
||||||
*.doc diff=astextplain
|
|
||||||
*.DOC diff=astextplain
|
|
||||||
*.docx diff=astextplain
|
|
||||||
*.DOCX diff=astextplain
|
|
||||||
*.dot diff=astextplain
|
|
||||||
*.DOT diff=astextplain
|
|
||||||
*.pdf diff=astextplain
|
|
||||||
*.PDF diff=astextplain
|
|
||||||
*.rtf diff=astextplain
|
|
||||||
*.RTF diff=astextplain
|
|
||||||
*.md text
|
|
||||||
*.tex text diff=tex
|
|
||||||
*.adoc text
|
|
||||||
*.textile text
|
|
||||||
*.mustache text
|
|
||||||
*.csv text
|
|
||||||
*.tab text
|
|
||||||
*.tsv text
|
|
||||||
*.txt text
|
|
||||||
*.sql text
|
|
||||||
|
|
||||||
# Graphics
|
|
||||||
*.png binary
|
|
||||||
*.jpg binary
|
|
||||||
*.jpeg binary
|
|
||||||
*.gif binary
|
|
||||||
*.tif binary
|
|
||||||
*.tiff binary
|
|
||||||
*.ico binary
|
|
||||||
# SVG treated as an asset (binary) by default.
|
|
||||||
*.svg text
|
|
||||||
# If you want to treat it as binary,
|
|
||||||
# use the following line instead.
|
|
||||||
# *.svg binary
|
|
||||||
*.eps binary
|
|
||||||
|
|
||||||
# Scripts
|
|
||||||
*.bash text eol=lf
|
|
||||||
*.sh text eol=lf
|
|
||||||
# These are explicitly windows files and should use crlf
|
|
||||||
*.bat text eol=crlf
|
|
||||||
*.cmd text eol=crlf
|
|
||||||
*.ps1 text eol=crlf
|
|
||||||
|
|
||||||
# Serialisation
|
|
||||||
*.json text
|
|
||||||
*.toml text
|
|
||||||
*.xml text
|
|
||||||
*.yaml text
|
|
||||||
*.yml text
|
|
||||||
|
|
||||||
# Archives
|
|
||||||
*.7z binary
|
|
||||||
*.gz binary
|
|
||||||
*.tar binary
|
|
||||||
*.zip binary
|
|
||||||
|
|
||||||
#
|
|
||||||
# Exclude files from exporting
|
|
||||||
#
|
|
||||||
|
|
||||||
.gitattributes export-ignore
|
|
||||||
.gitignore export-ignore
|
|
7
.gitignore
vendored
7
.gitignore
vendored
@ -1,10 +1,5 @@
|
|||||||
# ignore all vscode config files
|
# ignore all vscode config files
|
||||||
.vscode/*
|
.vscode/
|
||||||
!.vscode/settings.json
|
|
||||||
!.vscode/tasks.json
|
|
||||||
!.vscode/launch.json
|
|
||||||
!.vscode/extensions.json
|
|
||||||
!.vscode/numbered-bookmarks.json
|
|
||||||
|
|
||||||
# ignore all generated logfiles
|
# ignore all generated logfiles
|
||||||
*.log
|
*.log
|
||||||
|
19
.vscode/numbered-bookmarks.json
vendored
19
.vscode/numbered-bookmarks.json
vendored
@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"bookmarks": [
|
|
||||||
{
|
|
||||||
"fsPath": "$ROOTPATH$/root/scripts/backup.sh",
|
|
||||||
"bookmarks": [
|
|
||||||
-1,
|
|
||||||
478,
|
|
||||||
225,
|
|
||||||
-1,
|
|
||||||
-1,
|
|
||||||
-1,
|
|
||||||
-1,
|
|
||||||
-1,
|
|
||||||
-1,
|
|
||||||
-1
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
66
root/scripts/backup.sh
Executable file → Normal file
66
root/scripts/backup.sh
Executable file → Normal file
@ -33,15 +33,10 @@ function scriptHelp {
|
|||||||
echo -e "\tMailcow to operational status."
|
echo -e "\tMailcow to operational status."
|
||||||
echo -e "\nThe readme file included in this script's git contains detailed"
|
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 "usage information. The following is a brief summary:\n"
|
||||||
echo -e "${bold}***You MUST provide the full path to your mailcow"
|
echo -e "${bold}***This script scans for your mailcow configuration file"
|
||||||
echo -e "configuration file using the '-m' parameter***${normal}${default}"
|
echo -e "either with the default name or with your provided filename. If"
|
||||||
echo -e "${bold}${note}\nMandatory parameters:${normal}${default}"
|
echo -e "multiple files with this name are on your system, the script"
|
||||||
echo -e "${lit}\n-m, File name of the Mailcow build configuration file${default}"
|
echo -e "WILL get confused and exit with errors***${normal}${default}"
|
||||||
echo -e "FULL PATH to your Mailcow master build configuration file containing"
|
|
||||||
echo -e "all variables and configuration info unique to your Mailcow setup."
|
|
||||||
echo -e "The path specified here is also used for all docker-related"
|
|
||||||
echo -e "operations in this script."
|
|
||||||
echo -e "${info}Default: <none>${default}"
|
|
||||||
echo -e "${bold}${note}\nOptional parameters:${normal}${default}"
|
echo -e "${bold}${note}\nOptional parameters:${normal}${default}"
|
||||||
echo -e "${lit}\n-1, Timeout for containers to STOP before error${default}"
|
echo -e "${lit}\n-1, Timeout for containers to STOP before error${default}"
|
||||||
echo -e "The number of seconds to wait for a docker container to STOP"
|
echo -e "The number of seconds to wait for a docker container to STOP"
|
||||||
@ -68,12 +63,20 @@ function scriptHelp {
|
|||||||
echo -e "${lit}\n-d, File name of the docker-compose configuration file${default}"
|
echo -e "${lit}\n-d, File name of the docker-compose configuration file${default}"
|
||||||
echo -e "Name of the docker-compose configuration file that Mailcow uses"
|
echo -e "Name of the docker-compose configuration file that Mailcow uses"
|
||||||
echo -e "to build/start/stop all containers. This will only be searched"
|
echo -e "to build/start/stop all containers. This will only be searched"
|
||||||
echo -e "for in the path provided for your mailcow configuration file."
|
echo -e "for in the path found to contain your mailcow configuration file."
|
||||||
echo -e "${info}Default: docker-compose.yml${default}"
|
echo -e "${info}Default: docker-compose.yml${default}"
|
||||||
echo -e "${lit}\n-l, Location to save log file${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 "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 "structured in an way easy for log parsers (like Logwatch) to read."
|
||||||
echo -e "${info}Default: ScriptPath/ScriptName.log${default}"
|
echo -e "${info}Default: ScriptPath/ScriptName.log${default}"
|
||||||
|
echo -e "${lit}\n-m, File name of the Mailcow build configuration file${default}"
|
||||||
|
echo -e "Name of the Mailcow master build configuration file that has all"
|
||||||
|
echo -e "variables and configuration info unique to your Mailcow setup."
|
||||||
|
echo -e "This script will search for any file matching what you specify"
|
||||||
|
echo -e "so please ensure you don't have multiple files laying around with"
|
||||||
|
echo -e "the same name! The path where this file is found is used for all"
|
||||||
|
echo -e "docker-based operations in this script."
|
||||||
|
echo -e "${info}Default: mailcow.conf${default}"
|
||||||
echo -e "${lit}\n-v, Verbose output from borgbackup${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 "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 "If you need/want more detailed information, the verbose setting"
|
||||||
@ -257,10 +260,13 @@ fi
|
|||||||
|
|
||||||
# store the logfile in the same directory as this script using the script's name
|
# store the logfile in the same directory as this script using the script's name
|
||||||
# with the extension .log
|
# with the extension .log
|
||||||
scriptPath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
scriptPath="$( cd "$( dicontainerName "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
scriptName="$( basename ${0} )"
|
scriptName="$( basename ${0} )"
|
||||||
logFile="$scriptPath/${scriptName%.*}.log"
|
logFile="$scriptPath/${scriptName%.*}.log"
|
||||||
|
|
||||||
|
# Set default mailcow configuration filename
|
||||||
|
mailcowConfigFile=mailcow.conf
|
||||||
|
|
||||||
# Set default docker-compose filename
|
# Set default docker-compose filename
|
||||||
dockerComposeFile=docker-compose.yml
|
dockerComposeFile=docker-compose.yml
|
||||||
|
|
||||||
@ -381,8 +387,8 @@ while getopts ':l:v5:w:b:m:d:1:2:' PARAMS; do
|
|||||||
borgDetails="${OPTARG%/}"
|
borgDetails="${OPTARG%/}"
|
||||||
;;
|
;;
|
||||||
m)
|
m)
|
||||||
# full path to mailcow.conf configuration file
|
# name of mailcow configuration file
|
||||||
mailcowConfigFilePath="${OPTARG%/}"
|
mailcowConfigFile="${OPTARG}"
|
||||||
;;
|
;;
|
||||||
d)
|
d)
|
||||||
# name of docker-compose configuration file
|
# name of docker-compose configuration file
|
||||||
@ -412,33 +418,20 @@ if [ $(id -u) -ne 0 ]; then
|
|||||||
exit 3
|
exit 3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## verify mailcow.conf location provided
|
## Find mailcow configuration file so additional variables can be read
|
||||||
|
mailcowConfigFilePath=$( find / -mount -name "$mailcowConfigFile" -print )
|
||||||
if [ -z "$mailcowConfigFilePath" ]; then
|
if [ -z "$mailcowConfigFilePath" ]; then
|
||||||
echo -e "\n${err}You MUST provide the full path to your mailcow.conf" \
|
|
||||||
"configuration file. Exiting.${normal}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
## verify mailcow.conf and extract path
|
|
||||||
if checkExist ff "$mailcowConfigFilePath"; then
|
|
||||||
# extract directory name
|
|
||||||
case $mailcowConfigFilePath in
|
|
||||||
*/*)
|
|
||||||
mailcowPath=${mailcowConfigFilePath%/*}
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
mailcowPath="."
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
else
|
|
||||||
echo -e "\n${err}Could not locate the specified mailcow configuration" \
|
echo -e "\n${err}Could not locate the specified mailcow configuration" \
|
||||||
"file: ${lit}${mailcowConfigFilePath}${normal}"
|
"file: ${lit}${mailcowConfigFile}${normal}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# verify docker-compose.yml exists at location of mailcow.conf (standard setup)
|
## Find docker-compose file using mailcow configuration file path as a reference
|
||||||
dockerComposeFilePath="${mailcowPath}/${dockerComposeFile}"
|
mailcowPath="${mailcowConfigFilePath%/$mailcowConfigFile*}"
|
||||||
if ! checkExist ff "$dockerComposeFilePath"; then
|
dockerComposeFilePath="$mailcowPath/$dockerComposeFile"
|
||||||
|
checkExist ff "$dockerComposeFilePath"
|
||||||
|
checkResult="$?"
|
||||||
|
if [ "$checkResult" = 1 ]; then
|
||||||
echo -e "\n${err}Could not locate docker-compose configuration file:" \
|
echo -e "\n${err}Could not locate docker-compose configuration file:" \
|
||||||
"${lit}${dockerComposeFilePath}${normal}"
|
"${lit}${dockerComposeFilePath}${normal}"
|
||||||
exit 1
|
exit 1
|
||||||
@ -463,9 +456,8 @@ echo -e "${info}[$(stamp)] -- [INFO] using ${lit}${mailcowConfigFilePath}" \
|
|||||||
echo -e "${info}[$(stamp)] -- [INFO] using ${lit}${dockerComposeFilePath}" \
|
echo -e "${info}[$(stamp)] -- [INFO] using ${lit}${dockerComposeFilePath}" \
|
||||||
>> "$logFile"
|
>> "$logFile"
|
||||||
|
|
||||||
|
|
||||||
### Import additional variables from mailcow configuration file
|
### Import additional variables from mailcow configuration file
|
||||||
source "$mailcowConfigFilePath"
|
source "${mailcowConfigFilePath}"
|
||||||
|
|
||||||
### Export PATH so this script can access all docker and docker-compose commands
|
### Export PATH so this script can access all docker and docker-compose commands
|
||||||
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||||
|
Loading…
Reference in New Issue
Block a user