April 2024
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

Categories

April 2024
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

LOG using Shell script

#!/bin/sh
LOGFILE=/tmp/apache.log
SCRIPT_DIR=~/bin

logmsg () {
echo $(date): $1 >> $LOGFILE
}

while read instance
do
if [ -x  “${SCRIPT_DIR}/$instance” ] ; then
logmsg “Recycle $instance…”
“${SCRIPT_DIR}/$instance” start >> $LOGFILE 2>&1
else
logmsg “Cannot find recycle script for $instance – not starting”
fi
done < “${SCRIPT_DIR}/active-servers”
logmsg “Start script execution complete”

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>