source: MondoRescue/branches/2.2.2/mindi/rootfs/sbin/LogIt@ 1315

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

Log files are now consistent: mondoarchive.log for mondoarchive (containing also mindi.log) and mondorestore.log for mondorestore (copied from /tmp (ram) to /var/log (disk) at the end of the restore)
One include has been created for each bianry containing only that declaration ofr the moment, but which will be extended to include all local definitions (ps_* e.g.)
Doc updated accordingly
LOGFILE in restore process is now passed in the environment and not duplicated anymore
LogIt is not redifined either
LOGFILE should be put in environment by mondoarchive for mindi's usage but that's a step left for later.

  • Property svn:keywords set to Id
File size: 1.4 KB
RevLine 
[1]1#!/bin/sh
[746]2#
3# $Id: LogIt 1315 2007-04-16 14:13:59Z bruno $
4#
[1]5
6# if [ ! -e "/bin/date" ] ; then
7# currdate=""
8# else
9# currdate=`date +%H:%M`
10# fi
11currdate=""
12
[1315]13if [ _"$LOGFILE" = _"" ]; then
14 echo "LOGFILE was undefined. Using /tmp/mondorestore2.log"
15 LOGFILE="/tmp/mondorestore2.log"
16fi
17
[746]18if [ ! -e "$LOGFILE" ] ; then
19 echo "...first line..." > $LOGFILE
20fi
[1]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.