> XHTML 1.0 Transitional Invalid_ 

c u t u p @ c u t u p . o r g


[bash screencast] last modified: 03/25/2007 02:01 pm

Just for kicks I made a little script that takes a screenshot of my desktop, shrinks it, and uploads it to my server. I set it to run every minute with cron, and added some code that keeps it from updating if my screensaver is running.

Here's the code. It's pretty mac specific, using the screencapture and sips commands: #!/bin/bash

test=`ps -c -U $(whoami) | awk '/ScreenSaver/'`

if [ "$test" ]
 /usr/sbin/screencapture -C temp_screen_cap.jpg
 sips --resampleWidth 300 --setProperty format jpeg --setProperty formatOptions low temp_screen_cap.jpg --out temp_screen_cap.jpg
 scp "temp_screen_cap.jpg" user@server.com:path/to/screen.jpg
 rm temp_screen_cap.jpg

You need to modify the upload path and you can change the width, and this required generating a PGP pair for the local and remote machines as described here, otherwise you'd need to enter a password every time scp runs.

The entry in crontab looks like this (replace [TAB] with real tabs):

*/1[TAB]*[TAB]*[TAB]*[TAB]*[TAB]/Full/path/to/script > /dev/null 2>&1

For "porn mode" just comment out the line with a "#"

I dunno, I like it :)

UPDATE: Here's a more fleshed out script I use.

[All Posts] [top]