blob: e9657b472fcdfd669b6a3f502c69822252a9a40d (
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
#!/bin/sh
# logviewer.sh - a demonstration of opie-sh
#
# Copyright (C) 2002 gonz@directbox.com
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# 20020526-1a - initial release...
#
OPIE_SH=/opt/QtPalmtop/bin/opie-sh
INITPATH=/etc/init.d
######################################################################
# subroutines
about() {
( echo "<img src=/opt/QtPalmtop/pics/opie-sh-scripts/logviewer.png>"
echo "<h3>About</h3>"
echo "This little App should make it possible for you to "
echo "easily have a look at some of the syslogs. "
echo "<p>"
) | $OPIE_SH -t logviewer -f &
SCREENCLEAN=$!
sleep 1
}
cleanup() {
kill $SCREENCLEAN 2>/dev/null
rm -f /tmp/qcop-msg-logviewer.sh
}
choose_log() {
# ask what to do (start/stop/status)
#
$OPIE_SH -m -t "Select Log" \
-M "which logfile are you interested in ?<br>" \
-g -0 "PROC" -1 "SYSLOG"
RETURNCODE=$?
case $RETURNCODE in
-1) echo unexpected input detected, exiting.
cleanup ;;
0) LOGMETHOD=proc ;;
1) LOGMETHOD=syslog ;;
esac
}
######################################################################
# main
about
choose_log
case $LOGMETHOD in
proc) $OPIE_SH -m -t "Select Log" \
-M "which procfile ?<br>" \
-g -0 kmsg -1 "ksyms"
RETURNCODE=$?
case $RETURNCODE in
-1) cleanup ;;
0)
cat /proc/kmsg >/tmp/log.$$ &
PID=$!
sleep 2
kill $PID
( echo "<img src=/opt/QtPalmtop/pics/opie-sh-scripts/logviewer.png>"
echo "<h3>/proc/kmsg</h3>"
cat /tmp/log.$$
) | $OPIE_SH -t kmsg -f
rm -f /tmp/$$
cleanup ;;
1)
cat /proc/ksyms >/tmp/log.$$ &
PID=$!
sleep 2
kill $PID
( echo "<img src=/opt/QtPalmtop/pics/opie-sh-scripts/logviewer.png>"
echo "<h3>/proc/ksyms</h3>"
cat /tmp/log.$$
) | $OPIE_SH -t ksyms -f
rm -f /tmp/$$
cleanup ;;
*) cleanup ;;
esac
cleanup ;;
syslog)
if [ -f /var/log/messages ]
then
$OPIE_SH -t syslog -f /var/log/messages
else
echo "no syslogd installed or /var/log/messages inexistent." \
| $OPIE_SH -t syslog -f
fi
;;
*) cleanup ;;
esac
cleanup
|