LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-12-2005, 11:45 AM   #1
Ephracis
Senior Member
 
Registered: Sep 2004
Location: Sweden
Distribution: Ubuntu, Debian
Posts: 1,109

Rep: Reputation: 50
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.
 
Old 02-12-2005, 05:31 PM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
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
 
Old 02-24-2006, 08:46 AM   #3
habrys
LQ Newbie
 
Registered: Feb 2006
Posts: 3

Rep: Reputation: 0
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
outdated cronjobs bujecas Linux - Software 6 08-04-2005 10:24 AM
Taking Screenshots enik256 Linux - Newbie 5 03-02-2005 07:48 AM
The fastest reaction in auto-updates taking into consideration network security bugs? immer Linux - Distributions 1 10-23-2004 03:21 PM
urpmi --auto-select taking wayyy too long fulat2k Mandriva 4 10-07-2004 07:23 PM
facing problem with cronjobs manojthakkar Linux - General 7 12-09-2003 11:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration