logmanager: -N: adds -n to all subprocesses, compressor and cleaner runs only once a dir, not once an exp.

This commit is contained in:
Denis Knauf 2012-07-11 13:32:14 +02:00
parent f882193404
commit d0b68e706e

View file

@ -14,11 +14,18 @@ help() {
-z EXE Compressor (std: ./logcompressor) -z EXE Compressor (std: ./logcompressor)
-C EXE Cleaner (std: ./logcleaner) -C EXE Cleaner (std: ./logcleaner)
-n Gibt die Befehle aus, die Ausgefuehrt werden wuerden -n Gibt die Befehle aus, die Ausgefuehrt werden wuerden
-N Fuehrt die Unterprozesse mit -n aus
EOF EOF
exit exit
} }
x=`getopt hc:a:r:z:C:n "$@"` || exit 1 with_n() {
local cmd=$1
shift
"$cmd" -n "$@"
}
x=`getopt hc:a:r:z:C:nN "$@"` || exit 1
eval set -- $x eval set -- $x
while [ 0 -lt $# ] while [ 0 -lt $# ]
@ -34,6 +41,7 @@ do
-z) compressor="$1" ; shift ;; -z) compressor="$1" ; shift ;;
-C) cleaner="$1" ; shift ;; -C) cleaner="$1" ; shift ;;
-n) cmd=echo ;; -n) cmd=echo ;;
-N) cmd=with_n ;;
esac esac
done done
@ -63,7 +71,7 @@ do
exp="`dirname "${exp}"`" exp="`dirname "${exp}"`"
[ X = "X$e" ] || e="-e $e" [ X = "X$e" ] || e="-e $e"
$cmd $archiver "$e" "$dir" $cmd $archiver "$e" "$dir"
done
$cmd $compressor "$dir" $cmd $compressor "$dir"
[ 0 = "$age" ] || $cmd $cleaner "$age" "$dir" [ 0 = "$age" ] || $cmd $cleaner "$age" "$dir"
done done
done