summaryrefslogtreecommitdiffstats
path: root/web/attachments/153312-nagios-plugins-1.4-check_log.patch
blob: 7c8f43978e234eeb3decc6b1d562ea2c2830b11b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
*** nagios-plugins-1.4/plugins-scripts/check_log.sh.orig	Thu Feb  3 23:51:35 2005
--- nagios-plugins-1.4/plugins-scripts/check_log.sh	Fri Oct 21 10:34:23 2005
***************
*** 61,71 ****
  PATH=""
  
  ECHO="/bin/echo"
! GREP="/bin/grep"
  DIFF="/bin/diff"
  TAIL="/bin/tail"
  CAT="/bin/cat"
  RM="/bin/rm"
  
  PROGNAME=`/bin/basename $0`
  PROGPATH=`echo $0 | /bin/sed -e 's,[\\/][^\\/][^\\/]*$,,'`
--- 61,73 ----
  PATH=""
  
  ECHO="/bin/echo"
! GREP="/bin/egrep"
  DIFF="/bin/diff"
  TAIL="/bin/tail"
  CAT="/bin/cat"
  RM="/bin/rm"
+ CHMOD="/bin/chmod"
+ TOUCH="/bin/touch"
  
  PROGNAME=`/bin/basename $0`
  PROGPATH=`echo $0 | /bin/sed -e 's,[\\/][^\\/][^\\/]*$,,'`
***************
*** 191,198 ****
  else
      tempdiff=`/bin/date '+%H%M%S'`
      tempdiff="/tmp/check_log.${tempdiff}"
!     /bin/touch $tempdiff
!     chmod 600 $tempdiff
  fi
  
  $DIFF $logfile $oldlog > $tempdiff
--- 193,200 ----
  else
      tempdiff=`/bin/date '+%H%M%S'`
      tempdiff="/tmp/check_log.${tempdiff}"
!     $TOUCH $tempdiff
!     $CHMOD 600 $tempdiff
  fi
  
  $DIFF $logfile $oldlog > $tempdiff
***************
*** 201,207 ****
  count=`$GREP -c "$query" $tempdiff`
  
  # Get the last matching entry in the diff file
! lastentry=`$GREP "$query" $tempdiff | $TAIL --lines=1`
  
  $RM -f $tempdiff
  $CAT $logfile > $oldlog
--- 203,209 ----
  count=`$GREP -c "$query" $tempdiff`
  
  # Get the last matching entry in the diff file
! lastentry=`$GREP "$query" $tempdiff | $TAIL -1`
  
  $RM -f $tempdiff
  $CAT $logfile > $oldlog