Compare commits
4 Commits
2380d19a0d
...
257667f12a
Author | SHA1 | Date | |
---|---|---|---|
|
257667f12a | ||
|
9c8c250318 | ||
|
649d162d4c | ||
|
c3aa35ab15 |
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,
|
||||||
201,
|
301,
|
||||||
|
46,
|
||||||
|
386,
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
-1,
|
637
|
||||||
-1,
|
|
||||||
-1
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -43,7 +43,11 @@ badParam () {
|
|||||||
elif [ "$1" = "svc" ]; then
|
elif [ "$1" = "svc" ]; then
|
||||||
printf "${err}\nError: '%s %s': Service does not exist!${norm}\n\n" \
|
printf "${err}\nError: '%s %s': Service does not exist!${norm}\n\n" \
|
||||||
"$2" "$3"
|
"$2" "$3"
|
||||||
exit 1
|
exit 1
|
||||||
|
elif [ "$1" = "user" ]; then
|
||||||
|
printf "${err}\nError: '%s %s': User does not exist!${norm}\n\n" \
|
||||||
|
"$2" "$3"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +68,7 @@ cleanup () {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# remove EML temporary directory
|
# remove EML temporary directory
|
||||||
if ! rm -f "$exportDir" 2>>"$logFile"; then
|
if ! rm -rf "$exportDir" 2>>"$logFile"; then
|
||||||
printf "${warn}[%s] -- [WARNING] Could not remove EML export tmp dir:" \
|
printf "${warn}[%s] -- [WARNING] Could not remove EML export tmp dir:" \
|
||||||
"$(stamp)" >> "$logFile"
|
"$(stamp)" >> "$logFile"
|
||||||
printf "\n%s\n" "$exportDir" >> "$logFile"
|
printf "\n%s\n" "$exportDir" >> "$logFile"
|
||||||
@ -203,6 +207,7 @@ webroot="/usr/share/nginx/html"
|
|||||||
exportAll=0
|
exportAll=0
|
||||||
exportStart=$( date -d 'yesterday' +'%Y.%m.%d' )
|
exportStart=$( date -d 'yesterday' +'%Y.%m.%d' )
|
||||||
exportEnd=$( date -d 'yesterday' +'%Y.%m.%d' )
|
exportEnd=$( date -d 'yesterday' +'%Y.%m.%d' )
|
||||||
|
pilerUser='piler'
|
||||||
|
|
||||||
|
|
||||||
### process startup parameters
|
### process startup parameters
|
||||||
@ -293,6 +298,19 @@ while [ $# -gt 0 ]; do
|
|||||||
badParam empty "$@"
|
badParam empty "$@"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
--user)
|
||||||
|
# specify piler user account name
|
||||||
|
if [ -n "$2" ]; then
|
||||||
|
if id ${pilerUser} > /dev/null 2>&1; then
|
||||||
|
pilerUser="$2"
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
badParam user "$@"
|
||||||
|
fi
|
||||||
|
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"
|
||||||
@ -373,8 +391,12 @@ printf "${cyan}[%s] -- [INFO] Exporting EML files from piler --${norm}\n" \
|
|||||||
if ! exportDir=$( mktemp -d 2>>"$logFile" ); then
|
if ! exportDir=$( mktemp -d 2>>"$logFile" ); then
|
||||||
exitError 111 "Could not create temporary directory for exported EML files"
|
exitError 111 "Could not create temporary directory for exported EML files"
|
||||||
fi
|
fi
|
||||||
|
# grant pilerUser permission to write to temporary directory
|
||||||
|
if ! chown root:${pilerUser} "$exportDir" && chmod 660 "$exportDir"; then
|
||||||
|
exitError 112 "Could not set permissions on temporary directory"
|
||||||
|
fi
|
||||||
if ! cd "$exportDir"; then
|
if ! cd "$exportDir"; then
|
||||||
exitError 112 "Unable to change to temporary export directory"
|
exitError 113 "Unable to change to temporary export directory"
|
||||||
fi
|
fi
|
||||||
printf "${cyan}[%s] -- [INFO] EML files will be temporarily stored in:" \
|
printf "${cyan}[%s] -- [INFO] EML files will be temporarily stored in:" \
|
||||||
"$(stamp)" >> "$logFile"
|
"$(stamp)" >> "$logFile"
|
||||||
@ -619,7 +641,8 @@ exit 0
|
|||||||
# 3: borg not installed
|
# 3: borg not installed
|
||||||
# 99: TERM signal trapped
|
# 99: TERM signal trapped
|
||||||
# 111: could not create tmp dir for EML dump from piler-export
|
# 111: could not create tmp dir for EML dump from piler-export
|
||||||
# 112: could not change to tmp dir to start export operation
|
# 112: could not set permissions on tmp dir
|
||||||
|
# 113: could not change to tmp dir to start export operation
|
||||||
# 115: problem during piler-export operation
|
# 115: problem during piler-export operation
|
||||||
# 130: null configuration variable in details file
|
# 130: null configuration variable in details file
|
||||||
# 131: invalid configuration variable in details file
|
# 131: invalid configuration variable in details file
|
||||||
|
Loading…
Reference in New Issue
Block a user