I know that this was asked several times, but I don't know what to do... I've tried all the solutions proposed on AskUbuntu, but with no results...

So... I have this shell script in my home /home/napolux:

NOW=$(date +"%Y%m%d-%T")
cutycapt --url=http://example.com --out=/home/napolux/screens/yc.$NOW.png

The crontab is this:

* * * * * /home/napolux/yc-screens > /dev/null

cutycapt is a small command line tool that takes screenshots of webpages. The script (and the destination folder /home/napolux/script) as 777 permissions with execution flag.

The script is correct: by calling it via shell I can get the screenshot.

In /var/log/syslog I see the job running every minute.

May 18 20:13:01 ubu CRON[2649]: (CRON) info (No MTA installed, discarding output)
May 18 20:14:01 ubu CRON[2657]: (napolux) CMD (/home/napolux/yc-screens > /dev/null)
May 18 20:14:01 ubu CRON[2656]: (CRON) info (No MTA installed, discarding output)
May 18 20:15:01 ubu CRON[2662]: (napolux) CMD (/home/napolux/yc-screens > /dev/null)
May 18 20:15:01 ubu CRON[2661]: (CRON) info (No MTA installed, discarding output)

So, what can I do???

  • 5
    one note: never set a script to be chmod 777 - that means any user can edit the script as well as run it, which is a giant security hole. 755 is much safer. – ImaginaryRobots May 18 '12 at 21:18
  • It's a develpoment virtual machine with no security issue. I know which kind of permissions I have to set in real prod env. ;) – Napolux May 18 '12 at 21:24
  • 5
    @Napolux: It's never too early to develop good habits. – Keith Thompson May 18 '12 at 22:07
  • I have good abits, but sometimes you simply don't need them :) – Napolux May 19 '12 at 11:14

To get debugging output and being able to figure what's happening, I suggest you don't redirect output to /dev/null. You can either redirect to a file or remove the redirection altogether, in which case it will email your local user with a report. You can also set a MAILTO variable to have it send e-mail out to someone else (assuming you have a MTA correctly set up on the system).

So either:

* * * * * /home/napolux/yc-screens > /tmp/yc.log


* * * * * /home/napolux/yc-screens

My hunch is that you need to provide a full path to cutycapt (/usr/bin/cutycapt) but it may be something else. The best way to know for sure is to look at logs.

Also, I suggest you don't set the script and directory as 777, as that allows anyone to mess with them. Instead, set them as 755 and ensure that your user has permissions to write to the directory.

  • Tried your solution (log + abs. path to cutycapt). No output on log, no images saved... :( – Napolux May 18 '12 at 20:58

Found the problem... cutycapt needs some sort of X server to work properly, so I used xvfb as explained here...


  • 1
    Oh you kids these days with your fancy X servers and your GUIs :p Also consider wkhtmltoimage (link), which does not need any sort of X server and is available as a static binary (no dependencies). – ish May 18 '12 at 22:08
  • Kid? I'm 30 years old and my first computer was an 80286 :P – Napolux May 19 '12 at 11:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.