RE: ComLine tool Problem

> I'm having a problem using the ComLine tool in the library.  
> GET seems to  
> work fine, but when I use POST the process just hangs in the 
> same place ever time.

This issue has been up quite a few number of times. I use version 5.1 j and
the hangs are not that frequent, though they do occur. I think I showed how
to do a quick and dirty workaround in unix a while ago, but here it is
again, what I do is I add a "watchdog". This script runs in CSH under
Solaris 2.5.1 and may need some modifications on other platforms. I know
this is no good solution... Unfortunately I am a better shell scripter than
C-programmer :-)

#!/bin/csh -f

# *****************************************************************
# File: post_watchdog
# Called by:
#            whatever
# Calls:
#            bin/w3c
# Inputs:
#            N/A
# Outputs:
#            A POST to the web form indicated in $CGI
# Requirements:
#            N/A
# *****************************************************************

setenv CGI http://myserver.my.domain.com/mycgi.asp
 
# *************************************
# Make a database recordset in a temporary file
# *************************************

echo Retriving records from somewhere
set RECORDSET = `externalcommand`
echo Complete.

# *************************************
# POST the recordset, record by record,
# to the web form.
# *************************************

echo Posting records...
foreach ROW ( $RECORDSET )
    w3c -timeout 5 -n -post "${CGI}" -form "MY_CGI_VARIABLE=$ROW" &
    # Give this operation 5 seconds to complete
    sleep 5
    # If it didnt work, kill old process and try again and again
    # Perhaps you should use a different syntax for ps.
    set PROCLIST = `ps -e | grep w3c | nawk '{print $1}'`
    while ( "X$PROCLIST" != "X" )
	foreach PROCESS ( $PROCLIST )
	    echo "$PROCESS Doesnt seem to run, terminating..."
	    kill -TERM $PROCESS
	end
	echo "Trying again..."
	w3c -timeout 5 -post "${CGI}" -form "RECORD=$ROW" &
	# Give it twice the time here
	sleep 10
	set PROCLIST = `ps -e | grep w3c | nawk '{print $1}'`
    end
end
echo Complete.

# *************************************
# Clean up
# *************************************

exit(0)

Received on Friday, 30 October 1998 02:53:12 UTC