Commit 7f188b59 authored by Pavel Vainerman's avatar Pavel Vainerman

(uniset-vmonit): переделал обработку параметров командной строки

parent 41580f62
#!/bin/sh #!/bin/sh
PROG="${0##*/}"
WATCH=/usr/bin/watch WATCH=/usr/bin/watch
[ -z $WATCH_SEC ] && WATCH_SEC=5 [ -z $WATCH_SEC ] && WATCH_SEC=5
...@@ -23,24 +24,38 @@ print_usage() ...@@ -23,24 +24,38 @@ print_usage()
[ -n "$1" ] && exit "$1" || exit [ -n "$1" ] && exit "$1" || exit
} }
[ -z "$1" ] && print_usage 1
#parse command line options #parse command line options
TEMP=`getopt -n $PROG -o h,d,c:,s: -l help,dump,confile:,watch_sec: -- "$@"` || exit 1
eval set -- "$TEMP"
dump= dump=
confile= confile=
case "$1" in while :; do
-h|--help) print_usage 0;; case "$1" in
-s|--sec) shift; WATCH_SEC=$1; shift;; -h|--help) print_usage 0
-d|--dump) dump=1; shift;; ;;
-c|--confile) shift; confile=$1; shift;; -d|--dump)
esac dump=1
;;
OID=$1 -s|--watch_sec)
shift shift
WATCH_SEC="$1"
;;
-c|--confile)
shift
confile="$1"
;;
--) shift; break
;;
*) "unrecognized option: $1"
exit 1
;;
esac
shift
done
[ -n "$confile" ] && confile="--confile $confile" [ -n "$confile" ] && confile="--confile $confile"
[ -z "$dump" ] && $WATCH -n $WATCH_SEC uniset2-admin $confile --oinfo ${OID} $* [ -z "$dump" ] && $WATCH -n $WATCH_SEC uniset2-admin $confile --oinfo $*
[ -n "$dump" ] && uniset2-admin $confile --oinfo ${OID} $* [ -n "$dump" ] && uniset2-admin $confile --oinfo $*
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment