Skip to content

Instantly share code, notes, and snippets.

@niyaton
Last active December 15, 2015 03:58
Show Gist options
  • Save niyaton/5197741 to your computer and use it in GitHub Desktop.
Save niyaton/5197741 to your computer and use it in GitHub Desktop.
VNCのスクリーンショットを変化があった時だけ作成するスクリプト.cronに仕込んで使う.
#!/bin/bash -
new_filename=`date +\%Y\%m\%d\%H\%M\%S`.jpg
old_filename=`ls *.jpg | tail -n 1`
old_md5=`md5sum $old_filename | cut -d ' ' -f 1`
DISPLAY=":1.0" import -w root $new_filename
new_md5=`md5sum $new_filename | cut -d ' ' -f 1`
if [ $old_md5 = $new_md5 ]; then
rm $new_filename
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment