fuser detection (if not possible to run, exit). logcompressor: option-parse-fixes. logmanager: with_n prints command, ~ -> $HOME

This commit is contained in:
Denis Knauf 2012-07-30 12:24:51 +02:00
parent 82cb7d7012
commit 6b5020d24c
3 changed files with 17 additions and 9 deletions

View file

@ -28,6 +28,13 @@ do
done
shift `expr $OPTIND - 1`
if fuser "$0"
then :
else
echo "fuser not found or does not work! logarchiver won't to destroy any files, so exit."
exit 1
fi
if [ 0 -ge $# ]
then
echo "Error: DIR expected"

View file

@ -15,14 +15,14 @@ p=gzip
while getopts he:ngblxc: o
do
case "$o" in
--) break ;;
-h) help ;;
-n) n=echo ;;
-g) p=gzip ;;
-b) p=bzip2 ;;
-l) p=lzma ;;
-x) p=xz ;;
-c) p="$OPTARG" ;;
-) break ;;
h) help ;;
n) n=echo ;;
g) p=gzip ;;
b) p=bzip2 ;;
l) p=lzma ;;
x) p=xz ;;
c) p="$OPTARG" ;;
esac
done
shift `expr $OPTIND - 1`

View file

@ -22,6 +22,7 @@ EOF
with_n() {
__cmd=$1
shift
echo "$__cmd" -n "$@"
"$__cmd" -n "$@"
}
@ -41,7 +42,7 @@ do
done
shift `expr $OPTIND - 1`
for n in "$c" ./lmtab ~/.lmtab /etc/lmtab
for n in "$c" ./lmtab "$HOME/.lmtab" /etc/lmtab
do
if [ -f "$n" ]
then