[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Why my script is working only 95% of the time?
The following bash script seems to be working only 95% of the time. Can you
advise about it?
It might be a networking problem or timeout, although I doubt it. How can I
improve it or otherwise obtain further info about the problem?
From: root@rakefet (Cron Daemon)
To: shaul@localhost
Subject: Cron <shaul@rakefet> cd /tmp ; rm -f HungerSite* ; rm -f
0.0.*ImageContentItemDisplayComponent* ; wget -nv -q --cache=off -U Internet\
Explorer $(echo www.thehungersite.com$(wget -nv -q --cache=off -U Internet\
Explorer www.thehungersite.com ; grep "Donate Free Food" HungerSite | cut -d
\" -f 2 -)) ; grep title 0.0.*ImageContentItemDisplayComponent* | cut -b 8-35
; rm -f 0.0.*ImageContentItemDisplayComponent* ; rm -f HungerSite*
Date: Wed, 16 Aug 2000 06:33:27 +0300
grep: HungerSite: No such file or directory
grep: 0.0.*ImageContentItemDisplayComponent*: No such file or directory
Perhaps the problem is that MS Internet Explorer does not identify itself this
way? I have added the -U switch in the first place because when I was testing
it I found out that it seems to decrease the number of times that the script
failed. How does Netscape and other browsers identify themselves?
A somewhat more readable form of this script is:
cd /tmp
rm -f HungerSite*
rm -f 0.0.*ImageContentItemDisplayComponent*
wget -nv -q --cache=off -U Internet\ Explorer \
$(echo www.thehungersite.com$(wget -nv -q --cache=off -U Internet\
Explorer www.thehungersite.com ; \
# output should be in the file HungerSite
grep "Donate Free Food" HungerSite | cut -d \" -f 2 -))
# output should be placed in the file 0.0.*ImageContentItemDisplayComponent*
grep title 0.0.*ImageContentItemDisplayComponent* | cut -b 8-35
rm -f 0.0.*ImageContentItemDisplayComponent*
rm -f HungerSite*
On success the script is printing
The Hunger Site - Thank You!.
(At least this is what I think.)
BTW: It could have been written in Perl, Pyhton etc, which I am not familiar
with. I hardly know bash either. Therefore I am trying to concentrate on one
scripting language. And bash was the first I encountered.
Thus, if someone can
(improve this bash script) AND (suggest another script in another language)
I prefer the former (improving the bash script).
--
-- Shaul Karl <shaulk@israsrv.net.il>
Donate free food to the world's hungry: see http://www.thehungersite.com
=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il