Results 1 to 2 of 2

Thread: Running import thru cron

  1. #1
    Join Date
    Sep 2007
    Location
    USA
    Beans
    329
    Distro
    Ubuntu 13.10 Saucy Salamander

    Running import thru cron

    I was having some difficulty running screenshots thru cron and I've searched google and nothing had helped, so I figured I'd share my wisdom with the bunch.

    I've created a shell script that takes a screenshot of a window every minute. I'm running this cron locally under my own user. I am able to run this script manually without a problem.

    Code:
    ken:~$ crontab -u ken -l
    * * * * * /home/ken/capture >> /home/ken/test.log 2>&1
    * * * * * /home/ken/analyze
    test.log was throwing this error:
    Code:
    import: unable to open X server `0:0'.
    The key here was adding the exports $DISPLAY and $HOME:
    Code:
    DISPLAY=:0
    export DISPLAY
    HOME=/home/ken
    export HOME
    import -window "XP FXDD" -crop 16X28+1191+127 pic.jpg
    Once the exports were added to my script everything starting working fine. I ended up removing pcspkr (sudo modprobe -r pcspkr) because import beeps every time it takes a screenshot.

  2. #2
    Join Date
    Dec 2005
    Beans
    12

    Re: Running import thru cron

    Well it's been well over 2 years since you posted your tip but it just helped me figure out a problem I was having. Once I exported HOME as well as DISPLAY it worked perfectly.

    Thank you from Perth, Australia!
    Jason

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •