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