[Samba] bsd printing and samba 4.17

Peter Milesson miles at atmos.eu
Thu Feb 8 09:47:56 UTC 2024


On 2/8/24 08:57, Piviul via samba wrote:
> On 2/7/24 16:06, Peter Milesson via samba wrote:
>> Hi Piviul,
>>
>> I use the fantastically simple utility inoticoming for processing 
>> files hitting a directory during more than 10 years. I use it like this:
>>
>> inoticoming <watched dir> --suffix pdf sh <script for processing> {} 
>> \; 1> /dev/null 2> /dev/null
>>
>> In my case i use it for "remote" copying. The scanned file is stored 
>> in the <watched dir> and sent to a remote printer through the <script 
>> for processing> Note, the --suffix is case sensitive.
>>
>> inoticoming is available in Debian Bookworm.
>
> Thanks Peter, could be a solution; can I ask you something more about 
> inoticoming? I ask you because to monitor files added to some 
> directories and run consequently actions, I'm using the inotify-tools. 
> So I have created a service that read a .conf that contains the 
> directories to monitor and the actions to take. But I'm not a debian 
> developer and at every release upgrade I have some problem to have it 
> working... so I would ask you if inoticoming is already a service and 
> I can configure monitoring sources and actions to take in one or more 
> .conf files... should be great!
>
> Best regards
>
> Piviul
>
>
Hi Piviul,

Inoticoming runs as a daemon, using inotify. You can run as many daemons 
as you please for different paths and/or file extensions. Many 
distributions offer it as a package, but for example in Slackware, which 
in my case is the server OS, you need to compile it yourself from 
source. But I guess you don't have to update it very often. It's an old 
(but useful) piece of software. Below, I show 2 different cases of the 
scripts that are called from inoticoming:


#!/bin/bash
PGMDIR="/tmp/procurement"
if [ -r $PGMDIR/$1 ] && [ -s $PGMDIR/$1 ]; then
   lp -d Copier Procurement -o fit-to-page -o media=a4 $PGMDIR/$1
   rm $PGMDIR/$1
fi


#!/bin/bash
PGMDIR="/tmp/sales"
PRINTER="192.168.1.206"
while :
do
   ORGFILE=$(inotifywait -q -e create $PGMDIR --format "%w%f")
   echo "$ORGFILE"|tr '[:upper:]' '[:lower:]'|grep ".xps" 1> /dev/null 
2> /dev/null
   if [ $? -eq 0 ]; then
     hose $PRINTER 9100 --out cat $ORGFILE
   fi
   rm $ORGFILE
done


In the first example, the file is sent to the local lp daemon, in the 
2nd I use the equally ancient, but very useful, utility hose, to send 
files that pop up directly to a network connected printer. You can tweak 
everything to your liking, that's the best part of those tools.

Hope that you get it sorted.

Peter





More information about the samba mailing list