Mon scanner est connecté à mon serveur et est accessible par sane.d. Mais le problème est que allumer un pc pour scanner vite fait un courier important, ou faire une photocopie est laborieux! Heureusement le démon scanbuttond est là ....
Voici le script debian modifié permettant
- de photocopier
- d'envoyer par mail (économie de papier)
fichier /etc/scanbuttond/buttonpressed.sh
#!/bin/sh
# This script is started by scanbuttond whenever a scanner button has been pressed.
# Scanbuttond passes the following parameters to us:
# 1ドル ... the button number
# 2ドル ... the scanner's SANE device name, which comes in handy if there are two or
# more scanners. In this case we can pass the device name to SANE programs
# like scanimage.
TMPFILE="/tmp/scan.tiff"
TMPFILEJPG="/tmp/scan-`date +%Y-%m-%d.%H:%M:%S`.jpg"
FILEJPG="scan-`date +%Y%m%d%H%M%S`.jpg"
LOCKFILE="/tmp/scancopy.lock"
DEVICENAME=2ドル
scanmail()
{
SCAN_OPTIONS="--resolution 300 --contrast 10 --brightness 0"
scanimage --verbose --device-name $DEVICENAME \
--mode Gray -x 210 -y 297 $SCAN_OPTIONS | \
pnmtojpeg --quality=90 > $TMPFILEJPG
uuencode $TMPFILEJPG $FILEJPG | mail -s "scan:$FILEJPG" 1ドル
rm $TMPFILEJPG
}
scanprint()
{
SCAN_OPTIONS="--resolution 300 --contrast 10 --brightness 0"
scanimage --verbose --device-name $DEVICENAME \
--mode Gray -x 210 -y 297 $SCAN_OPTIONS | \
pnmtops -width=8.27 -height=11.69 | \
lpr -J $DEVICENAME $PRINTER
}
if ! lockfile-create --retry 2 $LOCKFILE; then
echo "Error: scanning already in progress for 2ドル"
exit
fi
case 1ドル in
1)
beep
scanmail "titi@mail.com;
;;
2)
beep
scanprint;
;;
3)
beep
scanmail "toto@mail.com";
;;
esac
lockfile-remove $LOCKFILE
Forum Astuces.divers [Debian] scanbuttond
Posté par mathieu mathieu .
Étiquettes :
10
nov.
2007
Suivre le flux des commentaires
Note : les commentaires appartiennent à celles et ceux qui les ont postés. Nous n’en sommes pas responsables.