How to print to a sleeping computer.

Adam Penny adam_penny at hotmail.com
Sat Feb 9 01:45:13 PST 2008


I now have wake on LAN printing. It's quite barebones at the moment, but it's doing the job.
The key ingredients are:

-Jerome Alet's Tea4Cups (Jerome recommended getting it with subversion: I had trouble downloading older versions via http initially)
Just do: svn co svn://svn.librelogiciel.com/tea4cups/tags/3.12/ tea4cups

-A perl/python script for wake on lan (I used the following perl script with an additional 'sleep(5);' added as the last line of the wake subroutine. I'm sleeping the script to give the printer host a chance to get its act together before it receives the print job.
The script is at http://gsd.di.uminho.pt/jpo/software/wakeonlan/
Put the script where you normally run scripts from (mine's in /usr/sbin)

A couple of other handy tips from Jerome that did make a difference were after having installed tea4cups, ensure that the permissions of the tea4cups file are the same as /usr/libexec/cups/backend/lpd
In my case, running OSX 10.5, this meant user being root, the group being wheel and the permissions being 0700.

Once tea4cups is installed, it just remains to add the prehook to tea4cups.conf
My prehook reads: prehook_wake : wakonlan [MAC address].

Slight limitations in what I've done so far are that you'll always have  a 5 second delay when you print, regardless of whether the host is asleep or not. Also, at the moment you've only got the option to wake one printing host based on the hard-coded MAC address in the prehook. I'm planning on using a user-defined plist containing printer names and host mac addresses so that the wake script can choose the MAC based on what tea4cups sends as $TEAPRINTERNAME. Also a check to see if the computer's already awake at the start of the wake script.

Hope it's useful to someone.




More information about the cups mailing list