func exitError for consistent error logging
This commit is contained in:
parent
2b8941da51
commit
9e335224a0
@ -35,6 +35,19 @@ badParam () {
|
||||
fi
|
||||
}
|
||||
|
||||
exitError () {
|
||||
errCode="error_$1"
|
||||
eval errReport='$'"$errCode"
|
||||
if [ -n "$errReport" ]; then
|
||||
printf "${err}[%s] -- [ERROR] %s: %s --${norm}\n" \
|
||||
"$(stamp)" "$1" "$errReport" >> "$logFile"
|
||||
else
|
||||
printf "${err}[%s] -- [ERROR] Unknown error code reported --${norm}\n" \
|
||||
"$(stamp)" >> "$logFile"
|
||||
fi
|
||||
exit "$1"
|
||||
}
|
||||
|
||||
# control seafile services (systemd)
|
||||
seafSvc () {
|
||||
if [ "$1" = "start" ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user