Screenshot upload script

I wrote up this script to take a screenshot and upload it to my webserver a while ago and I want to share it, so without further adieu, I give you ShotUp:

#!/bin/bash
## Screenshot Upload script
## by Justin Hayes

## variables
# screen capture delay
DELAY='2'
# screen capture quality
QUALITY='100'
# screen capture output format
OUTPUT='jpg'
# directory
DIR='/tmp'
# timestamp
TIMESTAMP=`date +%Y-%m-%d_%H-%M`
# hostname
HOST=`uname -n`
# remote user
RUSER='justin'
# remote host
RHOST='192.168.1.101'
# remote directory
RDIR='/var/www/justin-hayes.com/web/www/files/screenshots'
# web directory
WEBDIR='http://www.justin-hayes.com/files/screenshots'

## let's get down to business...
scrot -q $QUALITY -d $DELAY $DIR/screenshot_$HOST\_$TIMESTAMP.$OUTPUT

scp $DIR/screenshot_$HOST\_$TIMESTAMP.$OUTPUT $RUSER@$RHOST:$RDIR

firefox $WEBDIR/screenshot_$HOST\_$TIMESTAMP.$OUTPUT

Use the script by placing it in /usr/bin and calling the command shotup in the Gnome run dialog box or equivalent for other display environments. Please note that the upload will only work if you've setup SSH public key authentication.

Tags:

Comments

Post new comment

  • Allowed HTML tags: <a> <em> <strong> <b> <p> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • You can use BBCode tags in the text. URLs will automatically be converted to links.
  • You may use [inline:xx] tags to display uploaded files or images inline.
  • You may quote other posts using [quote] tags.
  • Each email address will be obfuscated in a human readable fashion or (if JavaScript is enabled) replaced with a spamproof clickable link.
  • You may insert videos with [video:URL]

More information about formatting options