forked from smaclennan/get-comics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
get-today-http
executable file
·50 lines (39 loc) · 856 Bytes
/
get-today-http
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/sh
# configurable
BASE=$HOME/public_html/comics
if false ; then
DIR=`date +%Y%m%d`
else
DIR=today
fi
# end
# For running from crontab
cd $BASE
mkdir -p $DIR
cd $DIR || { echo "Problems with $DIR"; exit 1; }
if [ 1 -eq 1 ] ; then
rm -f *
get-comics -d. | tee $BASE/output
fi
cd $BASE
cat<<EOF >index.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head><title>Comics for $DIR</title></head>
<body>
<center>
<h1>Comics for $DIR</h1>
EOF
if [ -s output ] ; then
echo "<p><table><tr><td><pre>" >> index.html
cat output >> index.html
echo "</pre></table>" >> index.html
echo "" >> index.html
fi
ls $DIR/*.gif $DIR/*.png $DIR/*.jpg | sed 's/.*/<p><img src="&" alt="&">/' >> index.html
cat<<EOF >>index.html
<p><a href="http://yow/comics.html">Comics Page</a>
</center>
</body>
</html>
EOF