3 # File: distribute_score
4 # Purpose: copies html to a staging area, then to the web dir and
5 # any other location/machine needed. Also invokes rotate_summary
6 # Author: pc2@ecs.csus.edu
7 # Revised: Sat May 14 13:28:29 PDT 2005
9 # $Id: distribute_score,v 1.2 2006/04/12 15:41:36 boudreat Exp $
13 set pc2_dir
="/usr/pc2"
14 set start_dir
="/home/scoreboard"
15 set web_dir
="/var/www/html"
16 set sum_dir
="$web_dir/summary"
17 set stage_dir
="$html_dir/staging"
18 set html_dir
="$start_dir/html"
19 set rotate_script
="$pc2_dir/samps/rotate_summary"
21 # END CUSTOMIZATION for now, look for CUSTOMIZE HERE down below
23 if (! -d $html_dir) then
24 echo "$html_dir does not exist, has pc2board been started yet ?"
29 if (! -d $stage_dir) then
30 echo "Creating $stage_dir"
32 if (! -d $stage_dir) then
33 echo "Could not create $stage_dir, check permissions of $html_dir"
39 if (! -d $web_dir) then
40 echo "$web_dir does not exist, is httpd installed ?"
45 if (! -d $sum_dir) then
46 echo "Creating $sum_dir"
48 if (! -d $sum_dir) then
49 echo "Could not create $sum_dir, check permissions of $web_dir"
56 if (! -f "$html_dir/summary.html") then
57 echo "$html_dir/summary.html does not exist."
58 echo "Has pc2board been started yet ?"
63 # ignore error warning about it not being aliased
64 unalias cp > /dev
/null
65 unalias rm > /dev
/null
67 echo -n Copying html files
at `date`
68 cp $html_dir/*.html
$stage_dir
69 # we echo a . after each step
71 foreach i
(`ls -1 $stage_dir`)
72 # ensure html files are complete
73 grep -q '</html>' $stage_dir/$i
74 if ($status == 0) then
81 cp $stage_dir/*.html
$web_dir
83 cp $web_dir/summary.html
$sum_dir
86 (cd $sum_dir;$rotate_script >& /dev
/null
)
88 # to spectator scoreboard
90 scp
-q $pc2_dir/pc2export.dat @score1
:/home
/team
0/board
92 # to a remote web server
93 # use web_dir or stage_dir here, as the html_dir may be in the process
95 (cd $web_dir;scp
-q summary.html scoreboard@
127.0.0.2:upload
)