Posted By

ThomasGHenry on 04/14/09


Tagged

Bash screenshot cron scrot screencapture


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

sulfurito


Capture and organize screenshot automatically once every 6 minutes


 / Published in: Bash
 

These are two separate code snippets. One is for a crontab, the other to be run by cron.

Together they create a new folder every day and fills it with 240 jpeg images (10 per hour) of whatever it is that you're doing.

The next step for me is to figure out how to automate the process of turning these into frames in a slideshow/video automatically from a daily script...

...becauseitwouldbeawesome.

  1. #! /bin/bash
  2. ################################
  3. ## name this: daily_sshots.sh ##
  4. ################################
  5. year=`date +%Y`
  6. month=`date +%m`
  7. day=`date +%d`
  8. now=`date +%Y%m%d%H%M%S`
  9. uname=//your user name
  10.  
  11. mkdir -p /home/$uname/Pictures/daily_screenshots/$year/$month/$day
  12.  
  13. DISPLAY=:0 scrot /home/$uname/Pictures/daily_screenshots/$year/$month/$day/sshot$now.jpg
  14.  
  15.  
  16. #######################################
  17. ## Then in a crontab via: crontab -e ##
  18. #######################################
  19.  
  20. # m h dom mon dow command
  21. */6 * * * * sh /path/to/above/code/in/file/daily_sshots.sh

Report this snippet  

You need to login to post a comment.