#!/bin/bash # konfera - dump window, convert it to html and upload it to www via ftp # # Copyright (C) 2002 Tomas Malek # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. function usage() { echo "konfera - dump window, convert it to html and upload it to www via ftp" echo "Written by Tomas Malek " echo "This is free software with ABSOLUTELY NO WARRANTY." echo "Usage: `basename $0` options " echo " -s server" echo " -d dir" echo " -u username" echo " -p password" echo " [-i interval]" echo " [-f file name]" exit } function konec() { cat >$TMP < $TITULEK
Konec... END ftp -n $SERVER </dev/null || { echo `basename $0`: you need to install ImageMagick; exit; } [ $# -eq "0" ] && usage INTERVAL=10 #implicitni hodnoty SOUBOR=konfera TMP=`mktemp /tmp/tmp.XXXXXX` || { echo `basename $0`: can"'"t create temp file; exit 1;} trap "rm $TMP" 0 P=0 while getopts ":s:d:u:p:f:i:" OPTION do case $OPTION in s ) [ "$OPTARG" != "" ] && { SERVER=$OPTARG ; P=$(($P | 1)) ; } || usage;; d ) [ "$OPTARG" != "" ] && { DIR=$OPTARG; P=$(($P | 2 )); } || usage;; u ) [ "$OPTARG" != "" ] && { USERNAME=$OPTARG; P=$(($P | 4)); } || usage;; p ) [ "$OPTARG" != "" ] && { PASS=$OPTARG; P=$(($P | 8)); } || usage;; f ) [ "$OPTARG" != "" ] && SOUBOR=$OPTARG;; i ) [ "$(($OPTARG))" -gt 0 ] && INTERVAL=$OPTARG;; esac done [ $(($P & 15)) -ne 15 ] && usage echo Choose your window... INFO=`xwininfo | grep "Window id"` ID=`echo $INFO | sed 's/.* \(0x[0-9a-fA-F]*\) .*/\1/'` TITULEK=`echo $INFO | sed 's/.*"\(.*\)".*/\1/'` echo echo ----------------------------------------------------------- echo window: $TITULEK echo interval: $INTERVAL s echo ftp: $SERVER echo username: $USERNAME echo file: $DIR/$SOUBOR.html echo ----------------------------------------------------------- echo Press CTRL-C to quit cat >$TMP < $TITULEK END ftp -n $SERVER </dev/null | convert xwd:- jpg:$TMP 2>/dev/null || break ftp -n $SERVER <