3

Possible Duplicate:
How to take a screenshot every n second?

How to take screenshots of a windows machine running Windows 2008 server from ubuntu 11.04 for every 30 minutes automatically? Right now what i am doing is, i access the windows machine from vnc viewer and capture the screenshot. I would like to automate this process, is it possible? If yes how? Can anyone explain in detail?

karthick87
  • 81,947
  • See i have mentioned to take the screenshot of a remote machine running windows. How do i access windows machine? – karthick87 Feb 11 '12 at 02:29

1 Answers1

1

There are so many possibilities:

Set up a webcam on your Linux box, point it to the Windows machine's screen so you can capture what's on it, set Windows up so that it doesn't lock or blank the screen. Install fswebcam and use cron to automate running it every 30 minutes. Create a file named e.g. cronfile containing this:

*/30 * * * * fswebcam -q "`date`.jpg"

Then activate the cronfile with:

crontab cronfile

this will put a timestamped file in your home dir every 30 minutes.

The first five fields in a crontab job definition decide when to run the job; this will simply run it every 30 minutes (*/30) of every hour, every day of every month (the 5th field allows you to decide which days of the week a job runs). The command that will be run is the rest of the line.

fswebcam takes a filename on which to save the captured image. In this case, we build the filename by using the output of the date command (the backticks tell the shell to first run the command within, and place its output value in there, before running the rest of the line). I also used double-quotes because the output of date can contain spaces, so the filename has to be quoted to work.

That's all there is to it.

Another option is to use VNC the way you're using it now. You'd have to set up both the Windows system and the Linux one to not blank the screen after some period of inactivity. Then you could use a screen capture program (I suggest shutter) and automate it running every 30 minutes using the same cron technique I describe above.

roadmr
  • 34,222
  • 9
  • 81
  • 93
  • You're taking a picture with the webcam. -1 for two reasons, doesn't solve the problem and is suspect. – jrg Feb 11 '12 at 20:02
  • How does it not solve the problem? how is it suspect? Please explain. – roadmr Feb 13 '12 at 01:47
  • Its using fswebcam - from what I can tell, its a system to take pictures with a webcam, not the screen. – jrg Feb 13 '12 at 01:53
  • The idea is to point the webcam at the screen. Apologies if that wasn't clear; I'll update the answer to clarify. It may be not as elegant as doing the same via VNC and/or rdesktop, however the basic concept should apply once you find a way to capture the image by any means. Thanks for replying! – roadmr Feb 13 '12 at 02:18