LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Taking auto screenshots using cronjobs (https://www.linuxquestions.org/questions/linux-general-1/taking-auto-screenshots-using-cronjobs-289335/)

Ephracis 02-12-2005 11:45 AM

Taking auto screenshots using cronjobs
 
I want to let crond run the import-command to take automatic screenshots. But that makes me end up with the error:
Code:

import: unable to open X server `'.
I understand why I am getting this but I hoped that there is some way to have a cron that can use X.

homey 02-12-2005 05:31 PM

Maybe you would have better luck using xwd which then has to be converted to jpg.....
Code:

#!/bin/bash
#stop time max is 2359
stop=1835
echo "Stop at  $stop"
now=`date +%k%M`

while [ $now -lt $stop ] ; do

  let num=$num+1
 
  # /usr/bin/import -window root image$num.jpg
 
  /usr/bin/X11/xwd -display :0 -root >image$num.xwd
  /usr/bin/convert image$num.xwd image$num.jpg
 
  #set the sleep time in seconds
  sleep 20
  now=`date +%k%M`
 
done

rm -f *.xwd
#this gets rid of the xwd files


habrys 02-24-2006 08:46 AM

Quote:

Originally Posted by Ephracis
I want to let crond run the import-command to take automatic screenshots. But that makes me end up with the error:
Code:

import: unable to open X server `'.
I understand why I am getting this but I hoped that there is some way to have a cron that can use X.

Hmmm... it actually works on my machine. I had explicitly say, which display I want to use - DISPLAY variable is not available for crond.

Like this:

import -display :0.0 -window root screenshot.jpg


All times are GMT -5. The time now is 05:25 PM.