source: trunk/mindi/rootfs/sbin/LogIt @ 30

Last change on this file since 30 was 30, checked in by bcornec, 14 years ago

Id property added on files to allow for better conf. management

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