2 # Conserve bandwidth - put a copy of Dilbert on your intranet.
3 # Run every morning with cron - after about 7am Eastern
4 ########################################################
9 # Where do you want the image put?
10 $dir="/usr/local/etc/httpd/htdocs/Dilbert";
11 # $dir = "c:/httpd/htdocs/Dilbert";
12 $location ="$dir/dilbert.gif";
14 $_ = get("http://www.unitedmedia.com/comics/dilbert/index.html");
16 # These next 4 lines will change every time they change the
17 # page layout on the Dilbert site. Check back on my web site
18 # if things suddenly stop working
19 s/^.*strip_left\.gif//s;
22 $line = "http://www.unitedmedia.com" . $_;
24 # Back up yesterday's image:
32 `mv $location $dir/dilbert.$id.gif`;
33 # If you're using this on NT, you may want to replace 'mv'
40 # Now get the actual image
43 open (FILE, ">$location");
44 binmode FILE; # Important for NT
48 # Now I want to update the index.html file
49 open (FILE, "$dir/index.html");
53 $yesterday = parsedate('yesterday');
54 $printdate = strftime('%a, %b %d', localtime($yesterday));
56 open (FILE, ">$dir/index.html");
60 print FILE "<td><a href=\"dilbert.$id.gif\">$printdate</a></td>\n";
61 if (($id % 5) == 0) {print FILE "</tr><tr>\n"}
63 else {print FILE "$_"};
67 # Start with an index.html file containing ...
69 # <!-- INSERT HERE -->
72 # And whatever else you want on the page.