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

master
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 done
shift `expr $OPTIND - 1` 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 $# ] if [ 0 -ge $# ]
then then
echo "Error: DIR expected" echo "Error: DIR expected"

View File

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

View File

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