add piler user param and err check
This commit is contained in:
parent
c3aa35ab15
commit
649d162d4c
4
.vscode/numbered-bookmarks.json
vendored
4
.vscode/numbered-bookmarks.json
vendored
@ -4,8 +4,8 @@
|
||||
"fsPath": "$ROOTPATH$/pilerbackup.sh",
|
||||
"bookmarks": [
|
||||
-1,
|
||||
201,
|
||||
-1,
|
||||
301,
|
||||
46,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
|
@ -43,7 +43,11 @@ badParam () {
|
||||
elif [ "$1" = "svc" ]; then
|
||||
printf "${err}\nError: '%s %s': Service does not exist!${norm}\n\n" \
|
||||
"$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
|
||||
}
|
||||
|
||||
@ -203,6 +207,7 @@ webroot="/usr/share/nginx/html"
|
||||
exportAll=0
|
||||
exportStart=$( date -d 'yesterday' +'%Y.%m.%d' )
|
||||
exportEnd=$( date -d 'yesterday' +'%Y.%m.%d' )
|
||||
pilerUser='piler'
|
||||
|
||||
|
||||
### process startup parameters
|
||||
@ -293,6 +298,19 @@ while [ $# -gt 0 ]; do
|
||||
badParam empty "$@"
|
||||
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 "${cyan}Use '--help' for valid options.{$norm}\n\n"
|
||||
|
Loading…
Reference in New Issue
Block a user