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",
|
"fsPath": "$ROOTPATH$/pilerbackup.sh",
|
||||||
"bookmarks": [
|
"bookmarks": [
|
||||||
-1,
|
-1,
|
||||||
332,
|
359,
|
||||||
65,
|
65,
|
||||||
|
185,
|
||||||
|
257,
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
-1,
|
603
|
||||||
-1,
|
|
||||||
576
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -183,6 +183,11 @@ err503Path="$scriptPath/503_backup.html"
|
|||||||
err503File="${err503Path##*/}"
|
err503File="${err503Path##*/}"
|
||||||
webroot="/usr/share/nginx/html"
|
webroot="/usr/share/nginx/html"
|
||||||
|
|
||||||
|
# piler-export related
|
||||||
|
exportAll=0
|
||||||
|
exportStart=$(date +'%Y.%m.%d')
|
||||||
|
exportEnd=$(date +'%Y.%m.%d')
|
||||||
|
|
||||||
|
|
||||||
### process startup parameters
|
### process startup parameters
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
@ -250,6 +255,28 @@ while [ $# -gt 0 ]; do
|
|||||||
badParam empty "$@"
|
badParam empty "$@"
|
||||||
fi
|
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 "${err}\nUnknown option: %s\n" "$1"
|
||||||
printf "${cyan}Use '--help' for valid options.{$norm}\n\n"
|
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" \
|
printf "${ok}[%s] -- [SUCCESS] Exported EML files from piler --${norm}\n" \
|
||||||
"$(stamp)" >> "$logFile"
|
"$(stamp)" >> "$logFile"
|
||||||
else
|
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"
|
exitError 115 "There was a problem while exporting EML from piler"
|
||||||
fi
|
fi
|
||||||
printf "${ok}[%s] -- [SUCCESS] Exported EML files from piler --${norm}\n" \
|
printf "${ok}[%s] -- [SUCCESS] Exported EML files from piler --${norm}\n" \
|
||||||
|
Loading…
Reference in New Issue
Block a user