How do I schedule web screenshots from a Linux box?
April 9, 2006 10:40 AM   Subscribe

I want to take a screenshot of a particular web-page every 15 minutes from a Linux server (no running X server). Ideally, I would like a command-line application, but a free or very cheap and reliable web service might work for me. What are my options?
posted by rjt to Computers & Internet (7 answers total) 2 users marked this as a favorite
Do you really want a screenshot?

You can download a URL with either curl or wget, both of which are available for linux.
posted by sohcahtoa at 10:58 AM on April 9, 2006

sounds like a job for gimp. however a google for screenshot of webpage led me to this
posted by psychobum at 11:03 AM on April 9, 2006

the problem with a screenshot is you have to render it, which is non-trivial. I'd definitely go the route of downloading the page along with any images it has & displaying it later.
posted by devilsbrigade at 12:17 PM on April 9, 2006

I implemented just what you described a couple weeks ago for a project, trying both khtml2png, and gtk + mozilla - neither of these options will run without X, however. Also, they're a bit funky. Paul's webkit2png actually runs better but is OS X only.

For service options, Browsershots is a community project that has a python tool as well. (1hr queue) Dan Vine has two tools w/ a 1-minute queue, but uses a captcha, so it might not be very scriptable. Commercially, you might want to check out SiteVista.

Browsershots is also open source, so you can take a look at that (I haven't dug through the code) to see if their code might help you do what you want.
posted by lhl at 2:19 PM on April 9, 2006

Best answer: You can do this with Xvfb or vncserver, by creating a virtual X-server that only displays to a memory area and directing the web browser to open on that display.

One example using vncserver, firefox and xwd to grab a screenshot:
> vncserver :3 # Starts a X-server as display :3
> DISPLAY=:3 firefox # Starts firefox on display :3
> xwd -display :3 -root > t.wd # Grabs a screenshot (you can grab single windows as well)
> convert t.wd t.png # Convert the screenshot to PNG-format
posted by rpn at 2:47 PM on April 9, 2006

Response by poster: rpn's solution looks like it can be made to work in my environment, but my thanks also to lhl.
posted by rjt at 6:09 PM on April 9, 2006

you could probably download the page with wget (with images etc), then use a2ps to render the page (via netscape/mozilla) and have mutt email the page to somewhere. Set it up a a cron job (man 5 crontab) and you're set # untested
posted by singingfish at 7:37 PM on April 9, 2006

« Older How badly have I messed up my taxes?   |   What art should I see in NYC? Newer »
This thread is closed to new comments.