[1] | 1 | #!/bin/sh
|
---|
[746] | 2 | #
|
---|
| 3 | # $Id: LogIt 1315 2007-04-16 14:13:59Z bruno $
|
---|
| 4 | #
|
---|
[1] | 5 |
|
---|
| 6 | # if [ ! -e "/bin/date" ] ; then
|
---|
| 7 | # currdate=""
|
---|
| 8 | # else
|
---|
| 9 | # currdate=`date +%H:%M`
|
---|
| 10 | # fi
|
---|
| 11 | currdate=""
|
---|
| 12 |
|
---|
[1315] | 13 | if [ _"$LOGFILE" = _"" ]; then
|
---|
| 14 | echo "LOGFILE was undefined. Using /tmp/mondorestore2.log"
|
---|
| 15 | LOGFILE="/tmp/mondorestore2.log"
|
---|
| 16 | fi
|
---|
| 17 |
|
---|
[746] | 18 | if [ ! -e "$LOGFILE" ] ; then
|
---|
| 19 | echo "...first line..." > $LOGFILE
|
---|
| 20 | fi
|
---|
[1] | 21 |
|
---|
| 22 | # LogIt $phrase ------ log only
|
---|
| 23 | # LogIt $phrase 1 ---- log & display
|
---|
| 24 | # LogIt $phrase 2 ---- log & display w/o LF
|
---|
| 25 | # LogIt $prhase 3 ---- log & display, blanking the current screen line
|
---|
| 26 | # before displaying message _with_ LF
|
---|
| 27 | # LogIt $phrase 9 ---- log IF --verbose is ON
|
---|
| 28 |
|
---|
| 29 | if [ "$#" = "1" ] ; then
|
---|
| 30 | echo -e "$currdate $1" >> $LOGFILE
|
---|
| 31 | elif [ "$#" = "2" ] ; then
|
---|
| 32 | if [ "$2" = "0" ] ; then
|
---|
| 33 | echo -e "$currdate $1" >> $LOGFILE
|
---|
| 34 | elif [ "$2" = "1" ] ; then
|
---|
| 35 | echo -e "$1"
|
---|
| 36 | echo -e "$currdate $1" >> $LOGFILE
|
---|
| 37 | elif [ "$2" = "2" ] ; then
|
---|
| 38 | echo -e -n " \r$1\r"
|
---|
| 39 | echo -e "$currdate $1" >> $LOGFILE
|
---|
| 40 | elif [ "$2" = "3" ] ; then
|
---|
| 41 | echo -e -n " \r$1\n"
|
---|
| 42 | echo -e "$currdate $1" >> $LOGFILE
|
---|
| 43 | elif [ "$2" = "9" ] ; then
|
---|
| 44 | if [ "$DEBUGGING" = "yes" ] ; then
|
---|
| 45 | echo -e "$currdate $1" >> $LOGFILE
|
---|
| 46 | fi
|
---|
| 47 | else
|
---|
| 48 | LogIt "LogIt '$1' '$2' .. unknown 2nd param"
|
---|
| 49 | exit 1
|
---|
| 50 | fi
|
---|
| 51 | else
|
---|
| 52 | LogIt "LogIt '$1' .. silly params"
|
---|
| 53 | exit 1
|
---|
| 54 | fi
|
---|
| 55 |
|
---|
| 56 |
|
---|
| 57 | exit 0
|
---|