forked from gjvanoldenborgh/climexp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
box2kml.cgi
executable file
·50 lines (43 loc) · 1.22 KB
/
box2kml.cgi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
. ./init.cgi
echo "Content-Type: text/html"
echo
echo
export DIR=`pwd`
. ./getargs.cgi
# printenv
email="$EMAIL"
if [ "$EMAIL" = [email protected] ]; then
lwrite = true
else
lwrite=false
fi
. ./nosearchengine.cgi
climate=`echo "$FORM_climate" | tr ' ' '_'`
prog="$FORM_prog"
listname="$FORM_listname"
extraargs="$FORM_extraargs"
plotlist=data/plotlist$$.txt
kml=data/climexp$$.kml
[ $lwrite = true ] && echo "bin/stationlist $listname $plotlist $prog list"
bin/stationlist $listname $plotlist $prog list
if [ ! -s $plotlist ]; then
. ./myvinkhead.cgi "Error" "No data were generated"
echo "Sorry, something went wrong. Please contact <a href=\"mailto:[email protected]\">me</a> to solve this."
. ./myvinkfoot.cgi
exit
fi
echo `date`" $EMAIL ($REMOTE_ADDR) list2kml $plotlist $climate $EMAIL $prog $extraargs" >> log/log
./bin/list2kml $plotlist $climate $EMAIL $prog $extraargs > $kml
if [ ! -s $kml ]; then
. ./myvinkhead.cgi "Error" "No KML was generated"
echo "Sorry, something went wrong. Please contact <a href=\"mailto:[email protected]\">me</a> to solve this."
. ./myvinkfoot.cgi
exit
fi
rm $plotlist
cat <<EOF
<html>
<meta http-equiv="Refresh" content="0;url=$kml">
</html>
EOF