-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathget-links
executable file
·51 lines (39 loc) · 933 Bytes
/
get-links
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
51
#!/bin/sh
# configurable
GET_COMICS=get-comics
BASE=$HOME/comics
OUT=`date +%Y%m%d`.html
# end
# For running from crontab
mkdir -p $BASE
cd $BASE || { echo "Problems with $BASE"; exit 1; }
$GET_COMICS -d . -l links.out > output.log
cat<<EOF >$OUT
<!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>
<p><a href="http://seanm.ca/comics.html">Comics Page</a>
EOF
if [ -s output.log ] ; then
echo "<p><table><tr><td><pre>" >> $OUT
cat output.log >> $OUT
echo "</pre></table>" >> $OUT
echo "" >> $OUT
fi
echo "<p><table>" >> $OUT
while read link; do
echo "<tr><td><img src=\"$link\">" >> $OUT
done < links.out
echo "</table>" >> $OUT
cat<<EOF >>$OUT
<p><a href="http://seanm.ca/comics.html">Comics Page</a>
</center>
</body>
</html>
EOF
rm links.out output.log
rm -f index.html
ln -s $OUT index.html