summaryrefslogtreecommitdiff
authorspiralman <spiralman>2002-10-18 21:16:13 (UTC)
committer spiralman <spiralman>2002-10-18 21:16:13 (UTC)
commit2ebb8c91374774171582f1a8ee4dbf4009a70615 (patch) (unidiff)
treedf4f8164ddd6acb8e498d780d6d59756c4ce7940
parent55a3c031fa5eba00a89ae5efa9b1d791eba9b9e7 (diff)
downloadopie-2ebb8c91374774171582f1a8ee4dbf4009a70615.zip
opie-2ebb8c91374774171582f1a8ee4dbf4009a70615.tar.gz
opie-2ebb8c91374774171582f1a8ee4dbf4009a70615.tar.bz2
fixed hostlist.sh thanks to wolfgang enderlein, ping command fixed, and can now have comments in hostlist
Diffstat (more/less context) (ignore whitespace changes)
-rwxr-xr-xnoncore/tools/opie-sh/scripts/hostlist.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/tools/opie-sh/scripts/hostlist.sh b/noncore/tools/opie-sh/scripts/hostlist.sh
index 6575e9c..6d70793 100755
--- a/noncore/tools/opie-sh/scripts/hostlist.sh
+++ b/noncore/tools/opie-sh/scripts/hostlist.sh
@@ -1,80 +1,80 @@
1#!/bin/sh 1#!/bin/sh
2 2
3# hostlist.sh - a demonstration of opie-sh 3# hostlist.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# 20020524-1 - icon to hostlist 17# 20020524-1 - icon to hostlist
18# 20020517-1 - added icon, changed name in launcher 18# 20020517-1 - added icon, changed name in launcher
19# 19#
20 20
21CFG=/opt/QtPalmtop/share/config/hostlist.cfg 21CFG=/opt/QtPalmtop/share/config/hostlist.cfg
22OPIE_SH=opie-sh 22OPIE_SH=opie-sh
23 23
24hostlist() { 24hostlist() {
25 (echo "<img src=/opt/QtPalmtop/pics/opie-sh-scripts/hostlist.png>" 25 (echo "<img src=/opt/QtPalmtop/pics/opie-sh-scripts/hostlist.png>"
26 echo "<h3>Hostlist</h3><br>" 26 echo "<h3>Hostlist</h3><br>"
27 HOSTLIST=`cat $CFG` 27 HOSTLIST=`cat $CFG | grep -v '#'`
28 for HOST in $HOSTLIST 28 for HOST in $HOSTLIST
29 do 29 do
30 PT=` ping -c1 $HOST | grep avg|cut -d " " -f4-` 30 PT=` ping -c 1 $HOST | grep avg|cut -d " " -f4-`
31 if [ "$PT" != "" ] 31 if [ "$PT" != "" ]
32 then echo "<b><font color=#00ff00> " 32 then echo "<b><font color=#00ff00> "
33 echo "$HOST is up<br></font></b>[$PT]<br>" 33 echo "$HOST is up<br></font></b>[$PT]<br>"
34 else echo "<b><font color=#ff0000> " 34 else echo "<b><font color=#ff0000> "
35 echo "$HOST is down<br></font></b>[$PT]<br>" 35 echo "$HOST is down<br></font></b>[$PT]<br>"
36 fi 36 fi
37 done 37 done
38) | $OPIE_SH -t "Which are up ?" -f 38) | $OPIE_SH -t "Which are up ?" -f
39 39
40 40
41} 41}
42 42
43cleanup() { 43cleanup() {
44 kill $SCREENCLEAN 44 kill $SCREENCLEAN
45 rm -f /tmp/qcop-msg-hostlist.sh 45 rm -f /tmp/qcop-msg-hostlist.sh
46} 46}
47 47
48about() { 48about() {
49 ( echo "<img src=/opt/QtPalmtop/pics/opie-sh-scripts/hostlist.png>" 49 ( echo "<img src=/opt/QtPalmtop/pics/opie-sh-scripts/hostlist.png>"
50 echo "<h3>About</h3>" 50 echo "<h3>About</h3>"
51 echo "This little App should make it possible for you to " 51 echo "This little App should make it possible for you to "
52 echo "check some hosts for availability." 52 echo "check some hosts for availability."
53 echo "<p>" 53 echo "<p>"
54 ) | $OPIE_SH -t hostlist -f & 54 ) | $OPIE_SH -t hostlist -f &
55 SCREENCLEAN=$! 55 SCREENCLEAN=$!
56 sleep 1 56 sleep 1
57} 57}
58 58
59##################################################################### 59#####################################################################
60# 60#
61# main 61# main
62 62
63about 63about
64 64
65# ask to: start or edit list 65# ask to: start or edit list
66$OPIE_SH -m -g -t Hostlist -M "Welcome!" -0 Start -1 "Edit Hostlist" 66$OPIE_SH -m -g -t Hostlist -M "Welcome!" -0 Start -1 "Edit Hostlist"
67RETURNCODE=$? 67RETURNCODE=$?
68case $RETURNCODE in 68case $RETURNCODE in
69 -1)echo died unexpectedly... | $OPIE_SH -f 69 -1)echo died unexpectedly... | $OPIE_SH -f
70 cleanup 70 cleanup
71 exit ;; 71 exit ;;
721) textedit $CFG 721) textedit $CFG
73 cleanup ;; 73 cleanup ;;
74 0)if [ -f $CFG ] 74 0)if [ -f $CFG ]
75 thenhostlist 75 thenhostlist
76 else echo www,handhelds.org >$CFG ; hostlist 76 else echo www,handhelds.org >$CFG ; hostlist
77 fi 77 fi
78 cleanup 78 cleanup
79 ;; 79 ;;
80esac 80esac