email PDF->gmail address->QUE->”label” to “Print”


Gmail Attachment Downloader Script

sudo apt-get install git
git clone http://github.com/thekindofme/gmail_attachment_downloader
cd gmail_attachment_downloader/
sudo apt-get install ruby
sudo apt-get install rubygems1.8
sudo gem install tmail
sudo apt-get install vim
vi gmail_attachment_downloader.rb

And below based on hacks.
here and here


#!/bin/bash
PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin
FILES=/home/wizard/printque/*.pdf

# Don’t path the rename directly – as the path may contain uppercase letters!
cd /home/wizard/printque
rename ‘y/A-Z/a-z/’ *

# shopt -s nullglob
# Took the above out on my Ubuntu – I got an error saying it was missing YMMV

for f in $FILES
do
echo “Processing $f file…”
lpr “$f”
rm “$f”
done

# Delete stray attachments which weren’t PDF files, but got downloaded anyway
rm /home/wizard/printque/*

#Make shutdown executable by any user for cron to be able to handle
sudo chmod u+s /sbin/shutdown

wizard@printer:~/gmail_attachment_downloader$ crontab -e

*/3 * * * * ruby ./gmail_attachment_downloader/gmail_attachment_downloader.rb 2>&1 > /dev/null # JOB_ID_1
01 19 * * * /sbin/shutdown -h now 2&1 > /dev/null # JOB_ID_2