From: Michel Normand Date: Thu, 29 Apr 2010 08:03:59 +0000 (+0200) Subject: lxc: add usage and help to lxc-netstat (V2) X-Git-Tag: lxc-0.7.0~98 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d72d3d7b1685a68d0e72c648dff4ec3a3ed82082;p=thirdparty%2Flxc.git lxc: add usage and help to lxc-netstat (V2) Signed-off-by: Michel Normand Signed-off-by: Daniel Lezcano --- diff --git a/src/lxc/lxc-netstat.in b/src/lxc/lxc-netstat.in index 1fecc5e64..9d9f76741 100644 --- a/src/lxc/lxc-netstat.in +++ b/src/lxc/lxc-netstat.in @@ -1,20 +1,39 @@ #!/bin/bash # set -ex +usage() { + echo "usage: $(basename $0) --name [netstat options]" +} + +help() { + usage + echo + echo "execute netstat for the specified container" + echo "with the added netstat options" + echo + echo "Options:" + echo "name : name of the container" + echo "help : this current help." + echo + echo "to be executed as root." +} + exec="" if [ $# -eq 0 ]; then - echo "usage: $0 -n " - exit 1 + usage + exit 1 fi for i in $*; do - case $i in - -n) - name=$2; shift 2;; - --exec) - exec="exec"; shift;; - esac + case $i in + -h|--help) + help; exit 1;; + -n|--name) + name=$2; shift 2;; + --exec) + exec="exec"; shift;; + esac done if [ -z "$exec" ]; then @@ -22,8 +41,8 @@ if [ -z "$exec" ]; then fi if [ -z "$name" ]; then - echo "usage: $0 -n " - exit 1 + usage + exit 1 fi cgroups=$(mount -l -t cgroup)