1 |
diff -ruN smeserver-audittools-1.4.0.old/root/sbin/e-smith/audittools/logcheck smeserver-audittools-1.4.0/root/sbin/e-smith/audittools/logcheck |
2 |
--- smeserver-audittools-1.4.0.old/root/sbin/e-smith/audittools/logcheck 1969-12-31 16:00:00.000000000 -0800 |
3 |
+++ smeserver-audittools-1.4.0/root/sbin/e-smith/audittools/logcheck 2014-02-02 13:32:30.000000000 -0800 |
4 |
@@ -0,0 +1,25 @@ |
5 |
+#!/bin/bash |
6 |
+#logcheck [days] [location] |
7 |
+re='^[0-9]+$' |
8 |
+days=2 |
9 |
+location=/tmp |
10 |
+ |
11 |
+# If there is a second arg, use it as the location |
12 |
+if ! [ -z "$2" ]; then |
13 |
+ location=$2 |
14 |
+fi |
15 |
+ |
16 |
+# If first arg is a number, then set days. |
17 |
+if ! [ -z "$1" ]; then |
18 |
+ if [[ $1 =~ $re ]] ; then |
19 |
+ days=$1 |
20 |
+ else |
21 |
+ location=$1 |
22 |
+ fi; |
23 |
+fi |
24 |
+ |
25 |
+echo "Log file: $location/log$(date +'%m%d%y')" |
26 |
+find /var/log/ -mtime -$days -print -exec sh -c 'cat "{}" | tai64nlocal | egrep -i "useless|warn|fail|error|disable|remov|unable|exit"' \; > "$location/log$(date +'%m%d%y')" 2>&1 |
27 |
+ |
28 |
+exit 0 |
29 |
+ |