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",
|
"fsPath": "$ROOTPATH$/pilerbackup.sh",
|
||||||
"bookmarks": [
|
"bookmarks": [
|
||||||
-1,
|
-1,
|
||||||
201,
|
301,
|
||||||
-1,
|
46,
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
|
@ -44,6 +44,10 @@ badParam () {
|
|||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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"
|
||||||
|
Loading…
Reference in New Issue
Block a user