english please. explizit export of HOME in logmanager.
This commit is contained in:
parent
706fec5dbb
commit
17bc80bb83
6
Makefile
6
Makefile
|
@ -27,6 +27,6 @@ testdir/.prepare: testdir testdir/.lmtab
|
||||||
.PHONY: testdir/.prepare
|
.PHONY: testdir/.prepare
|
||||||
|
|
||||||
test: testdir/.prepare testdir/.lmtab
|
test: testdir/.prepare testdir/.lmtab
|
||||||
cd testdir ; ../logmanager -nc .lmtab
|
cd testdir ; env -i HOME="$$HOME" ../logmanager -nc .lmtab
|
||||||
cd testdir ; ../logmanager -Nc .lmtab
|
cd testdir ; env -i HOME="$$HOME" ../logmanager -Nc .lmtab
|
||||||
cd testdir ; ../logmanager -c .lmtab
|
cd testdir ; env -i HOME="$$HOME" ../logmanager -c .lmtab
|
||||||
|
|
|
@ -1,19 +1,22 @@
|
||||||
#
|
#
|
||||||
# Diese Datei sollte ~/.lmtab heiszen.
|
# This file should be named ~/.lmtab
|
||||||
#
|
#
|
||||||
|
|
||||||
# Variablen, etwa damit fuser gefunden werden kann.
|
# Variables are possible. For example PATH, because fuser can't be found without it.
|
||||||
PATH=${PATH}:/usr/sbin
|
PATH=${PATH}:/usr/sbin
|
||||||
|
|
||||||
/opt/jbossmsg/jboss/server/default_4/log *.log 30
|
# example:
|
||||||
|
# archive all files:
|
||||||
|
# * in /opt/appsrv/jboss/server/cms/log
|
||||||
|
# * named *.log
|
||||||
|
# * retention for 30 days
|
||||||
|
#/opt/appsrv/jboss/server/cms/log *.log 30
|
||||||
|
|
||||||
# Vorsicht:
|
# Attantion:
|
||||||
# Keine Angabe der Zeit, wann die Datei entfernt werden soll,
|
# No given time ("") means default retention time (60 days!).
|
||||||
# bedeutet, dass sie nach 60 Tagen entfernt wird.
|
# If you want to hold these files forever, say "0".
|
||||||
# Wenn die Datei nie entfernt werden soll, 0 angeben.
|
#/opt/webserver/log * 0
|
||||||
|
|
||||||
#/var/opt/mmp/log/tomcat * 0
|
# / will be used as separator.
|
||||||
|
# More than one pattern in one directory.
|
||||||
# Mehrere Dateipatterns sind ebenso moeglich:
|
#/opt/dbsrc/log *.log.*/*.log
|
||||||
|
|
||||||
#/var/opt/mmp/log/mmp *.log.*/*.log
|
|
||||||
|
|
11
logarchiver
11
logarchiver
|
@ -7,11 +7,10 @@ n=
|
||||||
help() {
|
help() {
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
`basename "$0"` -h | [-i|-n] [-e EXP] DIR [DIR [...]]
|
`basename "$0"` -h | [-i|-n] [-e EXP] DIR [DIR [...]]
|
||||||
Dursucht DIR und dessen Unterverzeichnisse nach Dateien und verschiebt alle,
|
Look for files in DIR and his subdirs named like EXP and moves them to DIR/archive.
|
||||||
die auf den Ausdruck EXP passen nach DIR/archive.
|
-e EXP File must have this expression (std: "$e").
|
||||||
-e EXP Ausdruck, der gefunden werden soll (std: "$e")
|
-n Dummy mode. Shows files, which will be moved if not dummy mode.
|
||||||
-n Trockenlauf: Zeigt nur die Dateinamen an.
|
-i Asks you to move (see also mv)
|
||||||
-i Fragt nach (siehe mv)
|
|
||||||
EOF
|
EOF
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
@ -28,7 +27,7 @@ do
|
||||||
done
|
done
|
||||||
shift `expr $OPTIND - 1`
|
shift `expr $OPTIND - 1`
|
||||||
|
|
||||||
if fuser "$0" >/dev/null 2>/dev/null
|
if ( fuser "$0" >/dev/null 2>/dev/null )
|
||||||
then :
|
then :
|
||||||
else
|
else
|
||||||
echo "fuser not found or does not work! logarchiver won't to destroy any files, so exit."
|
echo "fuser not found or does not work! logarchiver won't to destroy any files, so exit."
|
||||||
|
|
|
@ -6,10 +6,10 @@ n=
|
||||||
help() {
|
help() {
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
Usage: `basename "$0"` -h | [-i|-n] [-a AGE] DIR [DIR [...]]
|
Usage: `basename "$0"` -h | [-i|-n] [-a AGE] DIR [DIR [...]]
|
||||||
Findet alle Dateien in DIR/archive, die zu alt sind und loescht sie.
|
Looks for all files in DIR/archive, which are older than AGE and removes these.
|
||||||
-a Alter der Datei in Tagen (std: $a)
|
-a AGE Maximal age of file in days to hold (std: $a).
|
||||||
-i Fragt vorher nach (siehe rm)
|
-n Dummy mode. Shows files to remove, if not in dummy mode.
|
||||||
-n Trockenlauf
|
-i Asks to remove (see also rm).
|
||||||
EOF
|
EOF
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
p=gzip
|
||||||
|
|
||||||
help() {
|
help() {
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
Usage: `basename "$0"` -h | [-n] [-g|-b|-l|-x|-c PACKER] DIR [DIR [...]]
|
Usage: `basename "$0"` -h | [-n] [-g|-b|-l|-x|-c ZIP] DIR [DIR [...]]
|
||||||
Komprimiert alle Dateien in DIR/archive.
|
Compress all uncompressed files in DIR/archive
|
||||||
-n Trockenlauf
|
-c ZIP Use this compressor ZIP (std: $p).
|
||||||
Packer: -g: gzip, -b: bzip2, -l: lzma, -x: xz, -c PACKER: einen anderen.
|
-n dummy mode. Shows files which will be compressed, if not in dummy mode.
|
||||||
|
Predefined compressors: -g: gzip, -b: bzip2, -l: lzma, -x: xz
|
||||||
EOF
|
EOF
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
p=gzip
|
|
||||||
|
|
||||||
while getopts he:ngblxc: o
|
while getopts he:ngblxc: o
|
||||||
do
|
do
|
||||||
case "$o" in
|
case "$o" in
|
||||||
|
|
16
logmanager
16
logmanager
|
@ -8,13 +8,14 @@ cmd=
|
||||||
|
|
||||||
help() {
|
help() {
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
`basename "$0"` -h | [-a EXE] [-z EXE] [-C EXE] -c CONF
|
`basename "$0"` -h | [-a EXE] [-z EXE] [-C EXE] [-c CONF]
|
||||||
-c CONF Konfigurationsdatei
|
-c CONF Config file (std: ./lmtab ~/.lmtab /etc/lmtab (first come first serve)
|
||||||
-a EXE Archiver (std: ./logarchiver)
|
-a EXE Archiver (std: ./logarchiver)
|
||||||
-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 Dummy mode: prints what will called if not dummy.
|
||||||
-N Fuehrt die Unterprozesse mit -n aus
|
-N Calls archiver, compressor and cleaner in dummy mode (-n).
|
||||||
|
-h Prints this.
|
||||||
EOF
|
EOF
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
@ -57,14 +58,15 @@ then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Read variables from config-file and export it as process variables.
|
||||||
eval `sed -ne '
|
eval `sed -ne '
|
||||||
s/#.*//;s/'\''/'"'\\\\\''"'/g;
|
s/#.*//;s/'\''/'"'\\\\\''"'/g;
|
||||||
s/\${\([a-zA-Z][0-9a-zA-Z_]*\)}/'\''"$\1"'\''/;
|
s/\${\([a-zA-Z][0-9a-zA-Z_]*\)}/'\''"$\1"'\''/;
|
||||||
s/^\([a-zA-Z_][0-9a-zA-Z_]*\)=\(.*\)/\1='\''\2'\''/p
|
s/^\([a-zA-Z_][0-9a-zA-Z_]*\)=\(.*\)/\1='\''\2'\''; export \1/p
|
||||||
' < "$c"`
|
' < "$c"`
|
||||||
|
|
||||||
# Format: Verzeichnis [Ausdruck[/Ausdruck[,...]] [Aufbewahrungszeit]]
|
# Format: Directory [Expression[/Expression[/...]]] [retention time]
|
||||||
# Verzeichnisse duerfen nur einmalig Vorkommen
|
# Directories must be uniq!
|
||||||
sed -ne 's/#.*//;s/^[a-zA-Z_][0-9a-zA-Z_]*=.*//;/\//p' "$c" | while read dir exp age opts
|
sed -ne 's/#.*//;s/^[a-zA-Z_][0-9a-zA-Z_]*=.*//;/\//p' "$c" | while read dir exp age opts
|
||||||
do
|
do
|
||||||
[ X = "X$age" ] || age="-a$age"
|
[ X = "X$age" ] || age="-a$age"
|
||||||
|
|
Loading…
Reference in a new issue