I usually do something like this:
Code:
LOG_WITH_APP_AND_TIME()
{
exec > $LOGFILE # redirect to logfile?
time=$(date +%H:%M )
if [ $# -gt 0 ];then
/usr/bin/echo [${0##*/}-$time] $@
else
/usr/bin/echo [${0##*/}-$time]
fi
}
alias LOG=LOG_WITH_APP_AND_TIME
if you want all output to a log file
call the script with the log file name scrip 2&1> >> logfile.
best not to sprinkle
echo > file type things everywhere.