source: MondoRescue/branches/stable/mindi/rootfs/sbin/LogIt@ 1339

Last change on this file since 1339 was 1339, checked in by Bruno Cornec, 17 years ago

Logfiles correct now in this branch for scripts in mindi

  • Property svn:keywords set to Id
File size: 1.4 KB
Line 
1#!/bin/sh
2#
3# $Id: LogIt 1339 2007-04-24 22:23:24Z bruno $
4#
5
6# if [ ! -e "/bin/date" ] ; then
7# currdate=""
8# else
9# currdate=`date +%H:%M`
10# fi
11currdate=""
12
13if [ _"$LOGFILE" = _"" ]; then
14 echo "LOGFILE was undefined. Using /tmp/mondorestore2.log"
15 LOGFILE="/tmp/mondorestore2.log"
16fi
17
18if [ ! -e "$LOGFILE" ] ; then
19 echo "...first line..." > $LOGFILE
20fi
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
29if [ "$#" = "1" ] ; then
30 echo -e "$currdate $1" >> $LOGFILE
31elif [ "$#" = "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
51else
52 LogIt "LogIt '$1' .. silly params"
53 exit 1
54fi
55
56
57exit 0
Note: See TracBrowser for help on using the repository browser.