#!/bin/bash ## This is a sample audit hook. I handles each pages as it comes in, and processes it. ## This should be setup with the following faxq config option: ## ## AuditHook: "/path/to/hook: R*" log() { logger -t "AudioHook[$$]" $* } do_page() { TIME=$((0x$1)); shift; ## Number seconds, in hex PAGE=$((0x$1)); shift; ## Page number, in hex PARAMS=$1; shift; ## encoded params TIF=$1; shift; ## recvq tiff file log "Handling page $PAGE [$(($PAGE-1))] of $TIF [$TIME]: $*"; ## TIFF directories are 0-based, pages are 1-based tiffcp $TIF,$(($PAGE-1)) /tmp/page-to-print.tif > /tmp/page-to-print.log 2>&1 tiffinfo /tmp/page-to-print.tif >> /tmp/page-to-print.log 2>&1 } HOOK=$1; shift MASK=${1#0x}; shift ID=$1; shift log $HOOK-$MASK "[$*]" case $HOOK-$MASK in RECV-0004) log "Processing page in $*" IFS=, do_page $* ;; *) log "Ignoring unhandled event" ;; esac