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