1

I am working on a project where I use Raspberry Pi as a print server. I need to save every document that is sent to the printer in hard drive that is attached to the Raspberry Pi. Can anyone suggest a method to do this?

Zanna
  • 72,312

1 Answers1

2

Read man inotify, which begins with:

NAME

   inotify - monitoring filesystem events

DESCRIPTION

   The  inotify API provides a mechanism for monitoring filesystem events.
   Inotify can  be  used  to  monitor  individual  files,  or  to  monitor
   directories.  When a directory is monitored, inotify will return events
   for the directory itself, and for files inside the directory.

Use it to monitor /var/spool/cups. The /var/spool/cups/c##### are "control" files, and /var/spool/cups/d#####-001 files are the actual data to be sent to the printer.

Note: At one time inotify did not work on all filesystem types, see Why won't `tail -f` follow my syslog when running live?

waltinator
  • 37,856