Removing uneeded file.
[and.git] / PC^2 / pc2 / samps / distribute_score
blob842ed1179d15e48ac72de07a4675cd837bd88426
1 #!/bin/csh
2 #
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
8 #
9 # $Id: distribute_score,v 1.2 2006/04/12 15:41:36 boudreat Exp $
12 # CUSTOMIZE HERE
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 ?"
25 echo
26 exit 99
27 endif
29 if (! -d $stage_dir) then
30 echo "Creating $stage_dir"
31 mkdir $stage_dir
32 if (! -d $stage_dir) then
33 echo "Could not create $stage_dir, check permissions of $html_dir"
34 echo
35 exit 96
36 endif
37 endif
39 if (! -d $web_dir) then
40 echo "$web_dir does not exist, is httpd installed ?"
41 echo
42 exit 98
43 endif
45 if (! -d $sum_dir) then
46 echo "Creating $sum_dir"
47 mkdir $sum_dir
48 if (! -d $sum_dir) then
49 echo "Could not create $sum_dir, check permissions of $web_dir"
50 echo
51 exit 97
52 endif
53 endif
54 cd $sum_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 ?"
59 echo
60 exit 99
61 endif
63 # ignore error warning about it not being aliased
64 unalias cp > /dev/null
65 unalias rm > /dev/null
66 while(1)
67 echo -n Copying html files at `date`
68 cp $html_dir/*.html $stage_dir
69 # we echo a . after each step
70 echo -n .
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
75 # good
76 else
77 rm $stage_dir/$i
78 endif
79 end
80 echo -n .
81 cp $stage_dir/*.html $web_dir
82 echo -n .
83 cp $web_dir/summary.html $sum_dir
84 # summary
85 echo -n .
86 (cd $sum_dir;$rotate_script >& /dev/null)
87 # CUSTOMIZE HERE
88 # to spectator scoreboard
89 echo -n .
90 scp -q $pc2_dir/pc2export.dat @score1:/home/team0/board
91 echo -n .
92 # to a remote web server
93 # use web_dir or stage_dir here, as the html_dir may be in the process
94 # of being written to
95 (cd $web_dir;scp -q summary.html scoreboard@127.0.0.2:upload)
97 # END CUSTOMIZATION
98 echo done.
99 sleep 30