Diffstat (limited to 'noncore/tools/opie-sh/scripts/logviewer.sh') (more/less context) (ignore whitespace changes)
-rwxr-xr-x | noncore/tools/opie-sh/scripts/logviewer.sh | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/noncore/tools/opie-sh/scripts/logviewer.sh b/noncore/tools/opie-sh/scripts/logviewer.sh index e9657b4..9b5dc25 100755 --- a/noncore/tools/opie-sh/scripts/logviewer.sh +++ b/noncore/tools/opie-sh/scripts/logviewer.sh | |||
@@ -1,116 +1,116 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | # logviewer.sh - a demonstration of opie-sh | 3 | # logviewer.sh - a demonstration of opie-sh |
4 | # | 4 | # |
5 | # Copyright (C) 2002 gonz@directbox.com | 5 | # Copyright (C) 2002 gonz@directbox.com |
6 | # | 6 | # |
7 | # This program is free software; you can redistribute it and/or modify | 7 | # This program is free software; you can redistribute it and/or modify |
8 | # it under the terms of the GNU General Public License as published by | 8 | # it under the terms of the GNU General Public License as published by |
9 | # the Free Software Foundation; either version 2, or (at your option) | 9 | # the Free Software Foundation; either version 2, or (at your option) |
10 | # any later version. | 10 | # any later version. |
11 | # | 11 | # |
12 | # This program is distributed in the hope that it will be useful, | 12 | # This program is distributed in the hope that it will be useful, |
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | # GNU General Public License for more details. | 15 | # GNU General Public License for more details. |
16 | # | 16 | # |
17 | # 20020526-1a - initial release... | 17 | # 20020526-1a - initial release... |
18 | # | 18 | # |
19 | 19 | ||
20 | OPIE_SH=/opt/QtPalmtop/bin/opie-sh | 20 | OPIE_SH=$OPIEDIR/bin/opie-sh |
21 | INITPATH=/etc/init.d | 21 | INITPATH=/etc/init.d |
22 | 22 | ||
23 | ###################################################################### | 23 | ###################################################################### |
24 | # subroutines | 24 | # subroutines |
25 | 25 | ||
26 | about() { | 26 | about() { |
27 | ( echo "<img src=/opt/QtPalmtop/pics/opie-sh-scripts/logviewer.png>" | 27 | ( echo "<img src=$OPIEDIR/pics/opie-sh-scripts/logviewer.png>" |
28 | echo "<h3>About</h3>" | 28 | echo "<h3>About</h3>" |
29 | echo "This little App should make it possible for you to " | 29 | echo "This little App should make it possible for you to " |
30 | echo "easily have a look at some of the syslogs. " | 30 | echo "easily have a look at some of the syslogs. " |
31 | echo "<p>" | 31 | echo "<p>" |
32 | ) | $OPIE_SH -t logviewer -f & | 32 | ) | $OPIE_SH -t logviewer -f & |
33 | SCREENCLEAN=$! | 33 | SCREENCLEAN=$! |
34 | sleep 1 | 34 | sleep 1 |
35 | } | 35 | } |
36 | 36 | ||
37 | cleanup() { | 37 | cleanup() { |
38 | kill $SCREENCLEAN 2>/dev/null | 38 | kill $SCREENCLEAN 2>/dev/null |
39 | rm -f /tmp/qcop-msg-logviewer.sh | 39 | rm -f /tmp/qcop-msg-logviewer.sh |
40 | } | 40 | } |
41 | 41 | ||
42 | choose_log() { | 42 | choose_log() { |
43 | # ask what to do (start/stop/status) | 43 | # ask what to do (start/stop/status) |
44 | # | 44 | # |
45 | $OPIE_SH -m -t "Select Log" \ | 45 | $OPIE_SH -m -t "Select Log" \ |
46 | -M "which logfile are you interested in ?<br>" \ | 46 | -M "which logfile are you interested in ?<br>" \ |
47 | -g -0 "PROC" -1 "SYSLOG" | 47 | -g -0 "PROC" -1 "SYSLOG" |
48 | RETURNCODE=$? | 48 | RETURNCODE=$? |
49 | 49 | ||
50 | case $RETURNCODE in | 50 | case $RETURNCODE in |
51 | -1) echo unexpected input detected, exiting. | 51 | -1) echo unexpected input detected, exiting. |
52 | cleanup ;; | 52 | cleanup ;; |
53 | 0) LOGMETHOD=proc ;; | 53 | 0) LOGMETHOD=proc ;; |
54 | 1) LOGMETHOD=syslog ;; | 54 | 1) LOGMETHOD=syslog ;; |
55 | esac | 55 | esac |
56 | } | 56 | } |
57 | 57 | ||
58 | ###################################################################### | 58 | ###################################################################### |
59 | # main | 59 | # main |
60 | 60 | ||
61 | about | 61 | about |
62 | choose_log | 62 | choose_log |
63 | 63 | ||
64 | case $LOGMETHOD in | 64 | case $LOGMETHOD in |
65 | proc) $OPIE_SH -m -t "Select Log" \ | 65 | proc) $OPIE_SH -m -t "Select Log" \ |
66 | -M "which procfile ?<br>" \ | 66 | -M "which procfile ?<br>" \ |
67 | -g -0 kmsg -1 "ksyms" | 67 | -g -0 kmsg -1 "ksyms" |
68 | RETURNCODE=$? | 68 | RETURNCODE=$? |
69 | case $RETURNCODE in | 69 | case $RETURNCODE in |
70 | -1) cleanup ;; | 70 | -1) cleanup ;; |
71 | 0) | 71 | 0) |
72 | 72 | ||
73 | cat /proc/kmsg >/tmp/log.$$ & | 73 | cat /proc/kmsg >/tmp/log.$$ & |
74 | PID=$! | 74 | PID=$! |
75 | sleep 2 | 75 | sleep 2 |
76 | kill $PID | 76 | kill $PID |
77 | ( echo "<img src=/opt/QtPalmtop/pics/opie-sh-scripts/logviewer.png>" | 77 | ( echo "<img src=$OPIEDIR/pics/opie-sh-scripts/logviewer.png>" |
78 | echo "<h3>/proc/kmsg</h3>" | 78 | echo "<h3>/proc/kmsg</h3>" |
79 | cat /tmp/log.$$ | 79 | cat /tmp/log.$$ |
80 | ) | $OPIE_SH -t kmsg -f | 80 | ) | $OPIE_SH -t kmsg -f |
81 | rm -f /tmp/$$ | 81 | rm -f /tmp/$$ |
82 | cleanup ;; | 82 | cleanup ;; |
83 | 83 | ||
84 | 1) | 84 | 1) |
85 | 85 | ||
86 | cat /proc/ksyms >/tmp/log.$$ & | 86 | cat /proc/ksyms >/tmp/log.$$ & |
87 | PID=$! | 87 | PID=$! |
88 | sleep 2 | 88 | sleep 2 |
89 | kill $PID | 89 | kill $PID |
90 | ( echo "<img src=/opt/QtPalmtop/pics/opie-sh-scripts/logviewer.png>" | 90 | ( echo "<img src=$OPIEDIR/pics/opie-sh-scripts/logviewer.png>" |
91 | echo "<h3>/proc/ksyms</h3>" | 91 | echo "<h3>/proc/ksyms</h3>" |
92 | cat /tmp/log.$$ | 92 | cat /tmp/log.$$ |
93 | ) | $OPIE_SH -t ksyms -f | 93 | ) | $OPIE_SH -t ksyms -f |
94 | rm -f /tmp/$$ | 94 | rm -f /tmp/$$ |
95 | cleanup ;; | 95 | cleanup ;; |
96 | 96 | ||
97 | *) cleanup ;; | 97 | *) cleanup ;; |
98 | esac | 98 | esac |
99 | cleanup ;; | 99 | cleanup ;; |
100 | 100 | ||
101 | syslog) | 101 | syslog) |
102 | 102 | ||
103 | if [ -f /var/log/messages ] | 103 | if [ -f /var/log/messages ] |
104 | then | 104 | then |
105 | $OPIE_SH -t syslog -f /var/log/messages | 105 | $OPIE_SH -t syslog -f /var/log/messages |
106 | else | 106 | else |
107 | echo "no syslogd installed or /var/log/messages inexistent." \ | 107 | echo "no syslogd installed or /var/log/messages inexistent." \ |
108 | | $OPIE_SH -t syslog -f | 108 | | $OPIE_SH -t syslog -f |
109 | fi | 109 | fi |
110 | ;; | 110 | ;; |
111 | *) cleanup ;; | 111 | *) cleanup ;; |
112 | esac | 112 | esac |
113 | 113 | ||
114 | 114 | ||
115 | cleanup | 115 | cleanup |
116 | 116 | ||