This is a read-only archive. Find the latest Linux articles, documentation, and answers at the new!

Feature: Entertainment

Get a daily dose of comics

By Michael Crider on August 30, 2007 (9:00:00 AM)

Share    Print    Comments   

When I first started learning to read, my primary motivation was to gain the ability to read the comics in my local paper. I had no idea at that time that there were so many comics in the world. Now I know that there are comics all over the Web, but who has time to go to each site each day and read the latest strip? Thanks to the world of open source software, you can gather all your favorite comics on one page automatically, ready for you to read each morning.

Dosage is "an application designed to keep a local 'mirror' of specific Web comics, with a variety of options for naming schemes and updating options. It supports a recursive 'catch-up' method, where it traverses a comic by essentially 'visiting' previous comics and picking out the comics." I have combined Dosage with the CGI Calendar of Events application to create a customized calendar with links to comics for each page.

Setting up: the prerequisites

Dosage is a command-line program; there is no GUI. You will also need a local Web server to use the calendar. On Debian derivatives such as Ubuntu, you can get one by installing the apache2 package: sudo apt-get install apache2.

Download the most recent version of Calendar of Events. You also need the CPAN Perl module CGI::Minimal. Extract the archives of the two packages with the commands tar xzf calendar.tar.gz and tar xzf CGI-Minimal-1.27.tar.gz.

In the root directory for Web documents (typically /var/www), create a directory called calendar. Copy config.txt and template.tmpl from the calendar archive to this new directory. If you know HTML, you can edit template.tmpl to change the look of the calendar if you like. Make config.txt writable by the user who will be running the comic collection script with the command chown username config.txt. config.txt will hold the list of events to be shown on the calendar, or, in our case, links to pages of comics. It comes with a list of holidays and special events that you can remove if you wish. You need to change the line starting template= to point to the directory where you placed template.tmpl -- i.e. template=/var/www/calendar/template.tmpl.

From the CGI-Minimal archive, copy the CGI directory under lib to the system cgi-bin directory (in Debian/Ubuntu the default location is /usr/lib/cgi-bin, but it may not exist if you have not installed any packages that use it -- the apache2 package does not create it). Also copy calendar.cgi and from the calendar archive to the system cgi-bin directory. In calendar.cgi, edit the line beginning my $default_file to point to the directory where you placed config.txt -- i.e. my $default_file = '/var/www/calendar/config.txt';

Preparing your dosage

Download the most recent stable release of dosage (1.5.8 at the time of this writing). Expand this archive as you did the calendar. You can place the expanded directory in your home directory, /usr/local, or any other location. For this howto I will assume it is in your home directory. Make the script that runs everything executable: chmod +x ~/dosage-1.5.8/bin/mainline.

Now you can pick the comics you want to read each day. The command ~/dosage-1.5.8/bin/mainline -l will give you a list of all comics supported by dosage. As of 1.5.8 there are 1,933 comics listed. If your terminal will not let you scroll back through that many lines, you may want to redirect the output to a text file, then open it in your favorite text editor. Write down the names of all comics you want to download, then run the following command in your home directory: ~/dosage-1.5.8/bin/mainline -c space separated list of comics. The command will take some time to complete, as it downloads a complete archive of each available comic in your list.

Next you want to make some links that will make these comics available to your Web server, and make the calendar event list available to the collection script you will build soon. In /var/www, run the command ln -s ~/Comics. In ~/Comics, run ln -s /var/www/calendar/config.txt\.

Now you are ready to build the bash script that will run daily to collect your comics. Open a text editor and copy the following lines into a blank text file:

cd ~
~/dosage-1.5.8/bin/mainline -ohtml @
echo -e "$(date +%Y)\t$(date +%-m)\t$(date +%-d)\t<a target="_blank" href="/Comics/html/comics-$(date +%Y%m%d).html">Comics</a>" >> ~/Comics/config.txt

Line two ensures that this script will run in your home directory. Line three calls dosage to download all newly available comics for each comic present in your ~/Comics directory, and write a Web page in ~/Comics/html which will link to each comic downloaded that day. Line four adds an entry to the Calendar of Events, linking to the new Web page.

Save this file in a location of your choice, with the name I collect scripts such as this inside my home directory, in a directory called bin. Make the script executable: chmod +x

Next, configure your system to run the script each day using cron. If you have never worked with cron, Wikipedia has a good introduction. crontab -e will present you with the crontab for your user. Add a line similar to the following at the bottom:

0 5 * * * ~/bin/

This line instructs the system to download any newly available comics at 5 a.m. each day. You can adjust the time to whatever works best for you.

In the morning, open your Web browser and point it to http://localhost/cgi-bin/calendar.cgi, and click on the Comics link to pull up a list of your favorite comics. Click on each link to read the comic. If you miss a day, you can still go back and read them the next day, as long as your computer was on when cron was scheduled to run the collection.

Consolidating the comics

Let's add one final touch to make this system even easier to use. Instead of putting links to each comic in the Web page, let's put the comics on the page itself. Open your favorite text editor again, and copy the following lines to a blank text file:

s,file:///home/your user name/Comics/html/,,g
s,file:///home/your user name/Comics,..,
s,<li><a href,<li><img src,

Save this file in the same directory as, with the name comics.sed. Now open, and add the following lines between lines three and four:

today=$(date +%Y%m%d)
sed -f ~/bin/comics.sed Comics/html/comics-$today.html > /tmp/comics.html
mv -f /tmp/comics.html Comics/html/comics-$today.html

The next time your collection script runs, you will be able to open a comics page in your browser that rivals any you can find in your local newspaper, because it has all, and only, the comics you want to read.

Michael Crider has been working with computers since 1987, and has been using various distros of Linux since 2000. By day he is a programmer and network administrator for a medium-sized company that runs 90% Linux on its servers and 75% Linux (using thin clients) on its desktops.

Share    Print    Comments   


on Get a daily dose of comics

Note: Comments are owned by the poster. We are not responsible for their content.

Get a daily dose of comics

Posted by: Anonymous [ip:] on August 30, 2007 10:44 AM
Such a geeky setup to read comics ! Down-to-earth people have the simpler option of using their favorite RSS reader and subscribing to their favorite webcomics. A lot of webcomics authors are actually sensible enough to embed the image in their feed.


Get a daily dose of comics

Posted by: Anonymous [ip:] on August 30, 2007 04:10 PM
Also worth considering is dailystrips- . It hasn't been updated for a while, but most of my favourites still work, and the strips.def file is readily configurable.

It's available as an ubuntu package, and probably for other distros too.


Get a daily dose of comics

Posted by: Anonymous [ip:] on August 30, 2007 10:32 PM
Does this download the ads for the webcomics too? If not, aren't you just ripping the artists off? They need to pay for their hosting somehow. I don't exactly like ads, but I do click on a couple now and then to finance sites I like. This software removes even that meager income for them.


Copyright and ad financed comic strips

Posted by: Anonymous [ip:] on August 31, 2007 07:58 AM
With such a script you get the content and steal the money from the creator.
As you know 'free' comic strips are financed through advertisements.
So perhaps your script should download banners to, you don't have to look at them.

And, if you provide the downloaded comic strips onto your Intranet site in form
of a aggregated page, your are infringing the copyright because you redistribute.



why not use the rss output ??

Posted by: Anonymous [ip:] on September 02, 2007 05:30 AM
You seem to be doing a lot of work to get roughly the same results as using -o rss. Just point your rss reader at dailydose.rss in the base of your comics directory.


Get a daily dose of comics

Posted by: Anonymous [ip:] on September 03, 2007 03:36 PM
I agree with the comments about ads. Somehow I left the last paragraph off the copy I submitted to It should have read:

From the good citizen department - many cartoonists make a living from the cartoons you will enjoy using this method, but this cuts off their methods of revenue. Several of them offer memberships on their website. If a paid membership is available for the cartoons you enjoy, I would encourage you to take advantage of this method of giving back to the artists who provide this entertainment for you. Also, do not give access to your web server to the outside world. Most cartoonists have strict rules against distributing their comics without permission. Normally this is not a problem if your computer is behind a router.

IANAL, but I don't think there would be a problem with making the comics available on a private intranet in your own home. I download the comics on my mythtv backend server, which is on all the time, but I read them from my laptop.
As far as the rss output, I had never tried that. From first glance it appears that you would still need to do some processing to get the actual comics on one page. Also, I have not found an rss reader that will read the file directly from the hard drive - they all want an http address. Maybe somebody can provide more details if I am wrong. On the other hand, if you don't want to run a full web server and have the convenient calendar access to archives, you can access the raw html files directly with any browser.


re: rss

Posted by: Anonymous [ip:] on September 04, 2007 04:37 AM
Sage for Firefox will read the rss file directly, and I would assume that there are other rss readers that will do the same.... but I may be wrong.


Get a daily dose of comics

Posted by: Anonymous [ip:] on December 12, 2007 02:19 PM
<a href="" title=" küresel ısınmaya hayır seo yarışması"> küresel ısınmaya hayır seo yarışması</a>


Get a daily dose of comics

Posted by: sernak plywood on December 12, 2007 02:46 PM
<a href=""> Sernak Plywood </a>

<a href=""> ARGE Yapi </a>


This story has been archived. Comments can no longer be posted.

Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya