Jerry D. Hedden wrote: >I have a cron job (a bash script) that runs every 6 minutes, polling >and downloading info off the web. > >The problem is the script hangs at various places and the stuck >processes keep building up. > >Further, I have to kill these processes using the task monitor: kill >reports 'No such process'.
Christopher Faylor replied: >As mentioned above, a test case showing the problem sure would be >nifty. Jerry D. Hedden responded: >I agree and would have provided one if I could. However, I have no >idea what is causing this, nor how to write a test case for it. > >As I said, it's a cron job running a bash script - nothing fancy. The >hang does not happen on every invokation of the script, but it does >occur frequently. Where in the script it gets stuck seems to be >random: wget, mkdir, mv, date, diff, etc.. Christopher Faylor asked: > Can you at least post the script? Certainly. Attached. Christopher Faylor asked: > Also, knowing the first snapshot which shows the problem would be helpful. Jerry D. Hedden responded: >As I said, these sort of problems started after the 2006-03-09 snapshot. > I double checked, and the problem does occur with the 2006-03-13 >snapshot. Christopher Faylor replied: >What you said was "However, I have experienced problems with most >snapshots after it", where "it" was the 2006-03-09 snapshot. The use of >the word "most" rather than "all" there implies, to me at least, that >there were snapshots that worked. You seem to now be saying that this >is not the case, which implies that something stopped working for you >on 2006-03-13 and that no snapshot on or after that point worked. Let me clarify. Starting with the 2006-03-13 snapshot, every snapshot I tried caused problems. Although I did not try every one (sorry, but I did not keep track of which ones), I know I tried over half of the 18 or so snapshots in question. Since none that I tried worked, I have been held at the 2006-03-09 snapshot. The basic problem noted in each case had to do with forks - either a cron script hangs (as reported), a build script fails because of fork failures ('resource not available' type messages), or couldn't bring up shell windows (as reported in http://cygwin.com/ml/cygwin/2006-03/msg00487.html). All of this started with Christopher Faylor's changes related to 'fork' that started with the 2006-03-13 snapshot. As I did report one problem related to this matter on the 3/15 but go no response, I figured the work was ongoing. I just kept trying subsequent snapshots hoping the problem would be cleared up eventually, but it hasn't.
#!/usr/bin/bash ##### # # weather - Downloads weather maps # # Usage: weather [ pause | resume ] [ show | unshow ] [ clean ] # # $RCSfile: weather,v $ # $Revision: 1.15 $ # $Date: 2006/03/20 15:01:54 $ # ##### function get_it { file=$1 url=$2 /usr/bin/wget -q --no-cache -T 15 -t 2 -O $file $url >>weather.log 2>&1 if [[ ! -s $file ]]; then rm -f $file echo "Failure getting $file: $url" >>weather.log date >>weather.log exit 1 fi } if [[ $LOGNAME == 'Jerry' ]]; then cd /y else cd /x fi if [[ ! -d Weather ]]; then mkdir Weather fi cd Weather # Pause in weather processing if [[ -n $1 ]]; then if [[ $1 == 'pause' ]]; then touch PAUSE echo 'Weather paused' exit 0 elif [[ $1 == 'resume' ]]; then rm -f PAUSE echo 'Weather resumed' elif [[ $1 == 'show' ]]; then weatherx exit 0 elif [[ $1 == 'unshow' ]]; then kill `cat /var/run/weatherx.pid` rm -f /var/run/weatherx.pid exit 0 elif [[ $1 == 'clean' ]]; then echo 'Cleaning...' today=`date +%m%d` for dir in map rsm rlg cur sat vis; do keep="$dir/$today" for x in $dir/????; do if [[ $x != $keep ]]; then rm -fr $x fi done done echo 'Done' exit 0 else echo "Unknown arg: $1" exit 1 fi fi if [[ -f PAUSE ]]; then exit 0 # Paused fi # Current weather get_it map.jpg http://image.weather.com/images/maps/current/curwx_720x486.jpg get_it rsm.jpg http://image.weather.com/web/radar/us_phl_ultraradar_large_usen.jpg get_it rlg.jpg http://image.weather.com/web/radar/us_har_closeradar_large_usen.jpg get_it cur.jpg http://image.weather.com/images/maps/current/cur_ec_720x486.jpg get_it sat.jpg http://image.weather.com/images/sat/regions/east_cen_sat_720x486.jpg get_it vis.jpg http://image.weather.com/images/sat/regions/ec_vis_sat_720x486.jpg today=`date +%m%d` now=`date +%H%M` for x in map rsm rlg cur sat vis; do if [[ ! -f $x.jpg ]]; then continue fi if [[ ! -s $x.jpg ]]; then rm -f $x.jpg continue fi if [[ ! -d $x/$today ]]; then mkdir -p $x/$today fi if [[ -f $x/.last ]]; then if [[ -f `cat $x/.last` ]]; then if diff -q `cat $x/.last` $x.jpg >/dev/null; then rm -f $x.jpg fi fi fi if [[ -f $x.jpg ]]; then echo $x/$today/$now.jpg >$x/.last mv $x.jpg $x/$today/$now.jpg fi done # Forecasts if [[ -d fore ]]; then rm -f fore/*.jpg else mkdir -p fore fi day=`date +%w` if [[ $day -ne 0 ]]; then day=$(( 7 - $day )) fi get_it fore/${day}_sun.jpg http://image.weather.com/images/maps/forecast/trend7_720x486.jpg day=$(( $day + 1 )) if [[ $day -eq 7 ]]; then day=0 fi get_it fore/${day}_mon.jpg http://image.weather.com/images/maps/forecast/fore1_720x486.jpg day=$(( $day + 1 )) if [[ $day -eq 7 ]]; then day=0 fi get_it fore/${day}_tue.jpg http://image.weather.com/images/maps/forecast/fore2_720x486.jpg day=$(( $day + 1 )) if [[ $day -eq 7 ]]; then day=0 fi get_it fore/${day}_wed.jpg http://image.weather.com/images/maps/forecast/fore3_720x486.jpg day=$(( $day + 1 )) if [[ $day -eq 7 ]]; then day=0 fi get_it fore/${day}_thu.jpg http://image.weather.com/images/maps/forecast/fore4_720x486.jpg day=$(( $day + 1 )) if [[ $day -eq 7 ]]; then day=0 fi get_it fore/${day}_fri.jpg http://image.weather.com/images/maps/forecast/fore5_720x486.jpg day=$(( $day + 1 )) if [[ $day -eq 7 ]]; then day=0 fi get_it fore/${day}_sat.jpg http://image.weather.com/images/maps/forecast/trend6_720x486.jpg get_it fore/_0_cur.jpg http://image.weather.com/images/maps/current/curwx_720x486.jpg if [[ $now < '0400' || $now > '1900' ]]; then get_it fore/_1_am.jpg http://image.weather.com/images/maps/forecast/amfcst_720x486.jpg get_it fore/_2_mid.jpg http://image.weather.com/images/maps/forecast/midfcst_720x486.jpg get_it fore/_3_pm.jpg http://image.weather.com/images/maps/forecast/pmfcst_720x486.jpg elif [[ $now < '1300' ]]; then get_it fore/_3_am.jpg http://image.weather.com/images/maps/forecast/amfcst_720x486.jpg get_it fore/_1_mid.jpg http://image.weather.com/images/maps/forecast/midfcst_720x486.jpg get_it fore/_2_pm.jpg http://image.weather.com/images/maps/forecast/pmfcst_720x486.jpg else get_it fore/_2_am.jpg http://image.weather.com/images/maps/forecast/amfcst_720x486.jpg get_it fore/_3_mid.jpg http://image.weather.com/images/maps/forecast/midfcst_720x486.jpg get_it fore/_1_pm.jpg http://image.weather.com/images/maps/forecast/pmfcst_720x486.jpg fi if [[ -s weather.log ]]; then date >>weather.log else rm weather.log fi # EOF
-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/