November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Categories

November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

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>