source: branches/2.2.4/mindi/rootfs/sbin/LogIt @ 1413

Last change on this file since 1413 was 1413, checked in by Bruno Cornec, 13 years ago

Log improvements again during restore

  • Property svn:keywords set to Id
File size: 1.4 KB
Line 
1#!/bin/sh
2#
3# $Id: LogIt 1413 2007-05-07 13:39:00Z bruno $
4#
5
6currdate="`date '+%H:%M'`"
7
8if [ _"$LOGFILE" = _"" ]; then
9    echo "LOGFILE was undefined. Using /tmp/mondorestore2.log"
10    LOGFILE="/tmp/mondorestore2.log"
11fi
12
13if [ ! -e "$LOGFILE" ] ; then
14    echo "Start of Restore" > $LOGFILE
15    echo "----------------" >> $LOGFILE
16    echo "Date: `date`" >> $LOGFILE
17    echo "----------------" >> $LOGFILE
18fi
19
20# LogIt $phrase ------ log only
21# LogIt $phrase 1 ---- log & display
22# LogIt $phrase 2 ---- log & display w/o LF
23# LogIt $prhase 3 ---- log & display, blanking the current screen line
24#                      before displaying message _with_ LF
25# LogIt $phrase 9 ---- log IF --verbose is ON
26
27if [ "$#" = "1" ] ; then
28    echo -e "$currdate $1" >> $LOGFILE
29elif [ "$#" = "2" ] ; then
30    if [ "$2" = "0" ] ; then
31    echo -e "$currdate $1" >> $LOGFILE
32    elif [ "$2" = "1" ] ; then
33    echo -e "$1"
34    echo -e "$currdate $1" >> $LOGFILE
35    elif [ "$2" = "2" ] ; then
36    echo -e -n "                                                                                \r$1\r"
37    echo -e "$currdate $1" >> $LOGFILE
38    elif [ "$2" = "3" ] ; then
39    echo -e -n "                                                                                \r$1\n"
40    echo -e "$currdate $1" >> $LOGFILE
41    elif [ "$2" = "9" ] ; then
42    if [ "$DEBUGGING" = "yes" ] ; then
43        echo -e "$currdate $1" >> $LOGFILE
44    fi
45    else
46    LogIt "LogIt '$1' '$2' .. unknown 2nd param"
47        exit 1
48    fi
49else
50    LogIt "LogIt '$1' .. silly params"
51    exit 1
52fi
53
54
55exit 0
Note: See TracBrowser for help on using the repository browser.