Finished logwrapper in general

This commit is contained in:
Nico Schottelius 2007-08-20 11:58:31 +02:00
parent 8bce8d8620
commit fe2d9d2fe5

View file

@ -2,11 +2,7 @@
# Nico Schottelius # Nico Schottelius
# written for Netstream (www.netstream.ch) # written for Netstream (www.netstream.ch)
# Date: Fr 8. Jun 10:30:24 CEST 2007 # Date: Fr 8. Jun 10:30:24 CEST 2007
# Call the log-wrapper instead of ccollect.sh and it will log # Call the log-wrapper instead of ccollect.sh and it will create nice logs
# to your selected destinations
# not implemented
exit 0
Analyses output produced by ccollect. Analyses output produced by ccollect.
@ -15,11 +11,32 @@ Analyses output produced by ccollect.
# #
CCOLLECT_CONF=${CCOLLECT_CONF:-/etc/ccollect} CCOLLECT_CONF=${CCOLLECT_CONF:-/etc/ccollect}
LOGCONF=$CCOLLECT_CONF/logwrapper LOGCONF=$CCOLLECT_CONF/logwrapper
VERSION=0.1
RELEASE="2007-XX-XX"
HALF_VERSION="ccollect $VERSION" logdir="${LOGCONF}/destination"
FULL_VERSION="ccollect $VERSION ($RELEASE)" CDATE="date +%Y%m%d-%H%M"
we="$(basenae $0)"
pid=$$
# syslog: logger -t ccollect-logwrapper logfile="${logdir}/$(${CDATE}).${pid}"
# use syslog normally
_echo()
{
logger "${we}-${pid}: $@"
echo "${we}-${pid}: $@"
}
# exit on error
_exit_err()
{
_echo "$@"
rm -f "${TMP}"
exit 1
}
# put everything into that specified file
_echo "Starting with arguments: $@"
touch "${logfile}" || _exit_err "Failed to create ${logfile}"
ccollect.sh "$@" > "${logfile}" 2>&1
_echo "Finished."