Eric Bodden, Ph.D. Current conditions in Darmstadt: Broken Clouds, 8°C (feels like 5°C)
8°C

Head of Secure Software Engineering Group at EC SPRIDE
Principal Investigator in Secure Services at CASED
  • rss
  • Home
  • Research
    • Publications
    • Presentations
    • Current research
      • Inter-procedural Data-flow Analysis of Software Product Lines
      • RefaFlex – Safer refactorings for reflective Java programs
      • Join Point Interfaces
      • Stateful Breakpoints
      • MOPBox
      • Closure Joinpoints for AspectJ
      • Proving Security Properties of Services
      • TamiFlex: a tool set for Taming Reflection
    • Past Research
      • Efficient Runtime Verification
      • Racer: Effective Race Detection Using AspectJ
      • Continuation-equivalent states (ICSE 2010)
      • Aspect-oriented programming and design
      • Visual specification languages
      • A denial-of-service attack on the Java bytecode verifier
      • Clara: Compile-time Approximation of Runtime Analyses
    • Hosting a Program Committee meeting with Skype
  • Tools
    • SPLlift – highly efficient product line analysis
    • Heros – Inter-Procedural Data-Flow Analysis
    • Behavior Compliance Control
    • Join Point Interfaces
    • TamiFlex: a tool set for Taming Reflection
    • Closure Joinpoints for AspectJ
    • Clara: Compile-time Approximation of Runtime Analyses
    • RacerAJ (for race detection)
    • An introduction to Soot 2.2.5
    • J-LO, a tool for runtime-checking temporal assertions
    • Aspect-oriented approaches targeting the .NET Framework
  • Teaching
    • Current lectures and thesis topics
    • Past lectures
      • Automated Software Engineering
      • Software-Engineering Project
      • COMP 520
      • COMP 621
  • About me
  • Photos

Printing over SSH in MacOS X

Eric | May 2, 2009

This week I found out that I can easily do something in MacOS X of which I did not actually think that it was easily possible: print over ssh! This is very convenient for me because I don’t have a printer at home. So now when I find some interesting article on the web and want to print it it’s just a button click and on the next morning I will find the document lying in the printer at work! Here’s how it works…

Paste the following into a file, let’s say, named “Print to remote printer” and place it into ~/Library/PDF Services/.

#!/bin/bash
TITLE="${!#}"
cat "${TITLE}" | ssh name@your.server.com lpr -P printername

Obviously you need to exchange name etc for your proper parameters. I personally have two scripts, for two different printers. Make the script executable, e.g. using chmod 755. That’s it!

The next time you print a document, the script will simply show up as a button in the PDF menu. Could it be any easier?
screenshot
An added benefit is that your document will actually sent as PDF, not in a pixel format, so that should be relatively low on the network bandwidth, and certainly it’s not going to cost you more than any manual upload.

UPDATE:

If you have growl installed, then you may find the following script more useful instead. It automatically notifies you about whether or not the print job succeeded.

#!/bin/bash
TITLE="${!#}"
cat "${TITLE}" | \
ssh name@your.server.com lpr -P printername && \
/usr/local/bin/growlnotify -m "Successfully sent ${TITLE} to printer." || \
/usr/local/bin/growlnotify -m "FAILED to send ${TITLE} to printer!" -s

growlnotify is a command-line tool that comes with the growl download package but is not installed by the default installer. If it’s not on your system then you need to install it using the script in the download package for growl.

Related Posts

No related posts.

Categories
Misc
Tags
Mac
Comments rss
Comments rss
Trackback
Trackback

« Nerd score Opening multiple eclipse workspaces in MacOS X »

4 Responses to “Printing over SSH in MacOS X”

  1. David (brazilian) says:
    May 5, 2009 at 2:21 pm

    Hi Eric,
    Thanks for that. Actually I never thought about this before.
    I was able to play a bit with the code (since I don’t have a mac) and make it work in cygwin (to a mac).
    Just for the fan of it I scored 95 in the nerd test. I am worried about it hahaha.
    Cheers

    Reply
    • eric says:
      May 5, 2009 at 4:00 pm

      95? Better get back to work then ;-)

      Reply
  2. Evgeny says:
    June 9, 2010 at 5:03 pm

    Should one expect ssh to ask for a password?
    Mine doesn’t, and nothing comes out of the printer as well.
    Any advice?

    Reply
    • Eric says:
      June 10, 2010 at 8:46 am

      Hi Evgeny. I think you may have to set up SSH to use public-key authentication with a password-less key. I am not sure if this will work otherwise. SSH will probably not ask for a key in this case because it’s not running in a shell.

      Reply

Leave a Reply

Click here to cancel reply.

Welcome

Welcome to my website. Interested in my research? Click here for details or jump directly to my publications.

Upcoming Conferences

SC 2013

SOAP 2013

ESEC/FSE 2013

PPPJ 2013

RV 2013

Photos

Categories & Feeds

  • Research
    RSS
    (177)
  • Misc
    RSS
    (99)
  • Montreal
    RSS
    (44)

Collaborations

  • Don Batory, UTA
  • Eric Tanter, Universidad de Chile
  • Friedrich Steimann, Fernuni Hagen
  • Grigore Rosu, UIUC
  • Hans Vangheluwe, McGill University/Universiteit Antwerpen
  • Jacques Klein, SnT Luxembourg
  • Klaus Havelund, NASA JPL
  • Laurie Hendren, McGill University
  • Martin Monperrus, Univ. of Lille
  • Matthew Dwyer, University of Nebraska
  • Oege de Moor, University of Oxford
  • Ondrej Lhotak, University of Waterloo
  • Patrick Lam, University of Waterloo
  • Rahul Purandare
  • Sarfraz Khurshid, UTA
  • Shahar Maoz, RWTH Aachen
  • Tian Zhao, UW Milwaukee
  • Volker Stolz, University of Oslo

Research projects

  • AspectBench Compiler (abc)
  • Clara
  • J-LO
  • Soot
  • Stratified aspects
  • TamiFlex

Service

  • AOSD 2006
  • AOSD 2007
  • AOSD 2010
  • AOSD 2011
  • AOSD 2012
  • ATPS 2013
  • ATVA 2008
  • ECOOP 2008 Doctoral Symposium
  • ECOOP 2010
  • ESEC/FSE 2011 New Ideas Track
  • ESEC/FSE 2013
  • FOAL 2010
  • FOAL 2012
  • FOAL 2013
  • ICSE 2010
  • ICSE 2013 (New Ideas)
  • IEEE Transactions on Software Engineering (TSE)
  • International Journal of Image and Graphics
  • ISSTA 2011
  • NFM 2011
  • OOPSLA 2008
  • OOPSLA 2010
  • OOPSLA 2012
  • PEPM 2008
  • PLDI 2006
  • PLDI 2008
  • RAM-SE 2011
  • RV 2007
  • RV 2009
  • RV 2010
  • RV 2011
  • SAC 2012
  • SC 2011
  • SC 2013
  • SEFM 2005
  • SEFM 2008
  • Transactions on Software Engineering and Methodology (TOSEM)
  • VMIL 2008
  • VMIL 2009

Some other people I know

  • Adrian Colyer
  • Bruno Dufour
  • Dan North
  • Daniel Klink
  • Dave Thomas
  • Dean Wampler
  • Eric Tanter
  • Friedrich Steimann
  • Joachim Kneis
  • Klaus Havelund
  • Kristin Lovejoy
  • Liz Keogh
  • Malte Clasen
  • Markus Schorn
  • Pascal Costanza
  • Patricia Jablonski
  • Philip Mayer
  • Ron Bodkin
  • Sven Wittig
  • Wiebke Berg

Some people not to confuse me with

  • Eric B. the terrorist
  • Eric Bodden the basketball player
  • Eric Bodden the chef who sunk
  • Master Sgt. Eric Bodden

Previous Posts

May 2009
M T W T F S S
« Apr   Jun »
 123
45678910
11121314151617
18192021222324
25262728293031

Tags

Alumni AOP AOSD AspectJ Atlanta Bike Blizzard Bug finding Caro Clara COMP 621 Eclipse FSE Google ISSTA Java LinkedIn Mac McGill Microsoft Montreal NASA Photos Programming Quebec City Race detection Racer Runtime Monitoring Runtime verification RV RWTH Seattle Slides Snow storm Soot Soot Tutorial Static Analysis Strike TamiFlex TA strike Thesis tracematches Typestate Vacation Winter carnival


rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox