#! /bin/tcsh set MAXITER=50000 # cd /mnt/home/akira/public_html/cgi-bin/scheduler echo "Content-type: text/html" echo "" #set CMDFILE=/tmp/schedcmd.temp.`echo $$` set CMDFILE=/tmp/schedcmd.temp.$$ # Putting the cat and the sed together doesnt work. Go figure. cat > $CMDFILE if (-z $CMDFILE) then # hitting 'reload' seems to not re-post the form data in some browsers. This # checks for that and prevents script breakage. rm -f $CMDFILE echo "" echo "" echo "Simulation error" echo "" echo "" echo "Your browser seems not to have reposted the form data. Please go back to" echo '' echo "http://www.capricorn.org/~akira/cgi-bin/scheduler/" and try again. echo echo exit endif set TEMP=`cat $CMDFILE` echo $TEMP | /usr/bin/sed -f ./sedscript > $CMDFILE set TEMP2=`cat $CMDFILE` set $TEMP2 #rm -f $CMDFILE set FILE=/tmp/jobs.tmp.`echo $$` # check for overload # average length = (max length + 1) * 0.5 # growth rate = average length * probability # estimated length = growth rate * iterations set length_equ="((($length + 1) * 0.5) * $probability) * $iterations" set est_length=`echo "iterations=$length_equ; iterations / 1" | /usr/bin/bc -q` if ($est_length > $MAXITER) then rm -f $CMDFILE echo "" echo "" echo "Simulation error" echo "" echo "" echo "Sorry, the values you have chosen would result in an overly long simulation" echo "(estimated length $est_length cycles)." echo "Please go back to " echo '' echo "http://www.capricorn.org/~akira/cgi-bin/scheduler/" and try again. echo echo exit endif echo "" echo "" echo "Simulation run on `date`" echo "" echo "" if ($iterations > $MAXITER) then echo Sorry, you have exceeded the maximum number of iterations \($MAXITER\). echo Your simulation is being truncated. echo '

' set iterations=$MAXITER endif echo "

Parameters:

" echo $iterations iterations \ echo Probability $probability \ echo Max $length cycles\ echo Estimated cycles to completion: $est_length\ echo "

" limits -t 3 ./jobgen $iterations $probability $length > $FILE # copy the file, one for each small image gen. script cp $FILE $FILE.1 cp $FILE $FILE.2 cp $FILE $FILE.3 echo \ echo \\\
echo \\ echo \\\
echo First Come First Served\ echo \ echo \\ echo Round-Robin\ echo \ echo \\ echo Shortest Job Next\ echo \ echo \\ echo \ echo "" echo "" rm -f $CMDFILE # rm -f $FILE /tmp/jobs.tmp1 /tmp/jobs.tmp2 /tmp/jobs.tmp3