add export date params and defaults
This commit is contained in:
parent
6944db98d4
commit
8a747a2eaf
8
.vscode/numbered-bookmarks.json
vendored
8
.vscode/numbered-bookmarks.json
vendored
@ -4,15 +4,15 @@
|
||||
"fsPath": "$ROOTPATH$/pilerbackup.sh",
|
||||
"bookmarks": [
|
||||
-1,
|
||||
332,
|
||||
359,
|
||||
65,
|
||||
185,
|
||||
257,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
576
|
||||
603
|
||||
]
|
||||
}
|
||||
]
|
||||
|
@ -183,6 +183,11 @@ err503Path="$scriptPath/503_backup.html"
|
||||
err503File="${err503Path##*/}"
|
||||
webroot="/usr/share/nginx/html"
|
||||
|
||||
# piler-export related
|
||||
exportAll=0
|
||||
exportStart=$(date +'%Y.%m.%d')
|
||||
exportEnd=$(date +'%Y.%m.%d')
|
||||
|
||||
|
||||
### process startup parameters
|
||||
while [ $# -gt 0 ]; do
|
||||
@ -250,6 +255,28 @@ while [ $# -gt 0 ]; do
|
||||
badParam empty "$@"
|
||||
fi
|
||||
;;
|
||||
-a|--all)
|
||||
# export ALL email stored in piler
|
||||
exportAll=1
|
||||
;;
|
||||
--start)
|
||||
# export starting at this date
|
||||
if [ -n "$2" ]; then
|
||||
exportStart="$2"
|
||||
shift
|
||||
else
|
||||
badParam empty "$@"
|
||||
fi
|
||||
;;
|
||||
--end)
|
||||
# export ending at this date
|
||||
if [ -n "$2" ]; then
|
||||
exportEnd="$2"
|
||||
shift
|
||||
else
|
||||
badParam empty "$@"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
printf "${err}\nUnknown option: %s\n" "$1"
|
||||
printf "${cyan}Use '--help' for valid options.{$norm}\n\n"
|
||||
@ -345,7 +372,7 @@ if [ "$exportAll" -eq 1 ]; then
|
||||
printf "${ok}[%s] -- [SUCCESS] Exported EML files from piler --${norm}\n" \
|
||||
"$(stamp)" >> "$logFile"
|
||||
else
|
||||
if ! pilerexport -a $exportStart -b $exportEnd 2>>"$logFile"; then
|
||||
if ! pilerexport -a "$exportStart" -b "$exportEnd" 2>>"$logFile"; then
|
||||
exitError 115 "There was a problem while exporting EML from piler"
|
||||
fi
|
||||
printf "${ok}[%s] -- [SUCCESS] Exported EML files from piler --${norm}\n" \
|
||||
|
Loading…
Reference in New Issue
Block a user