source: MondoRescue/branches/2.2.9/mindi/rootfs/sbin/LogIt@ 3320

Last change on this file since 3320 was 3320, checked in by Bruno Cornec, 9 years ago
  • Re-add (thanks git BTW) the 2.2.9 branch which had been destroyed in the move to 3.0
  • Property svn:executable set to *
File size: 1.8 KB
Line 
1#!/bin/sh
2#
3# $Id: LogIt 2726 2011-02-26 10:38:29Z 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
18 if [ "`grep -i quiet /proc/cmdline`" ]; then
19 echo "QUIET mode activated. Only error msgs are printed" >> $LOGFILE
20 echo "----------------" >> $LOGFILE
21 fi
22fi
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
31if [ "$#" = "1" ] ; then
32 echo -e "$currdate $1" >> $LOGFILE
33elif [ "$#" = "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
59else
60 LogIt "LogIt '$1' .. silly params"
61 exit 1
62fi
63
64
65exit 0
Note: See TracBrowser for help on using the repository browser.