On Wed, Oct 21, 2009 at 5:04 AM, Alex Huth <[email protected]> wrote:
> Hi!
>
> I have installed logsurfer and didn't found a rc.script. Then i have tried
> to
> build on my own, but that didn't work. Can someone give me a rc script for
> logsurfer?
>
i don't have an rc script per se, as i use daemontools to handle this
service. but i'll include my run scripts in case you or others might find
them useful.
here is the logsurfer-prod run script i use:
#!/bin/sh
INSTANCE="prod"
CONFIG="etc/${INSTANCE}.cfg"
STATE="var/${INSTANCE}.state"
LOGFILE="/var/log/messages"
LOGGER=`which logger`
TIMESTAMP=`date +%F-%H%M%S`
LOGMSG="LOGSURFER ${INSTANCE} STARTUP ${TIMESTAMP}"
LOGSURFER=`which logsurfer`
${LOGGER} -p warn -t logsurfer "${LOGMSG}"
sleep 1
exec ${LOGSURFER} -t -d ${STATE} -c ${CONFIG} -r "${LOGMSG}" -f ${LOGFILE}
and here is my logsurfer-rotate run script:
#!/bin/sh
INSTANCE="prod"
LOGFILE="/var/log/messages"
LOGMSG="LOGSURFER ${INSTANCE} STARTUP"
LOGGER=`which logger`
LOGCMD="${LOGGER} -p warn -t logsurfer"
while true
do {
sleep 60
CONTENTS=`grep "${LOGMSG}" ${LOGFILE}`
[ -z "${CONTENTS}" ] && \
{
${LOGCMD} "unable to find ${LOGMSG}"
${LOGCMD} "assuming logfile ${LOGFILE} has been rotated"
${LOGCMD} "attempting to restart logsurfer"
svc -t /service/logsurfer-${INSTANCE}
}
}
done