0

I want to take screenshot from my web automatically using crontab. I have installed cutycapt on my server. But I get this error when running it :

enter image description here

My question is :

  1. What's wrong with that error ?
  2. What is the best way to capture screenshot of my web page, cutycapt or phantomjs ?
  3. What is needed to use cutycapt or phantomjs ? I don't understand how cutycapt or phantomjs works.

I'll be grateful if there is any one who can explain this to me. Thanks.

TheRob
  • 133
  • 2
  • 10

2 Answers2

1

To get it to work in a "headless" environment I used xvfb, I'd already installed xserver, but I do not believe it is required. I did not intentionally install phantomjs, but it may be a dependancy.

sudo apt-get install xvfb cutycapt

And I then launched cutycapt in an xvfb framebuffer and sent some arguments. This is taken from the cutycapt source forge usage page.

xvfb-run --server-args="-screen 0, 1024x768x24" cutycapt --url=website.com --out=image.png

I also wrote a little script to make it even easier. It asks you which page to download. saves it as as the the url.png

#!/bin/bash
echo what is the website you would like to grab?
read url
echo grabbing $url please wait...
xvfb-run --server-args="-screen 0, 1024x768x24" cutycapt --url=$url --out=$url.png
echo done, image is $url.png
Tom J Race
  • 26
  • 4
0

The error message means CutyCapt needs a X server running. PhantomJS 2.x is headless, it does not need a X server running.

Julien
  • 5,729
  • 4
  • 37
  • 60