#!/bin/bash ## ## This is a simple JobControl program to "queue" jobs. Users submit ## Jobs, but they will be "queued" until they are "approved" by some ## means of moderation ## ## To use this server effectively for batching, basically controlling ## simple destination based modemgroups, etc. You should have the ## following settings in $SPOOL/etc/config for FaxQueuer: ## MaxBatchJobs: 10 # Or whatever your comfortable with ## JobControlCmd: bin/jobcontrol-queue.sh ## JobControlWait: yes JOBID=$1 ## ## GetJobParam ## - returns the value of the job param GetJobParam () { grep "^$1:" sendq/q$JOBID | cut -d : -f 2- } ## ## SetControlParam SetControlParam () { echo "$1: \"$2\"" } OWNER=$(GetJobParam owner) CLIENT=$(GetJobParam client) case "$OWNER@$CLIENT" in root@localhost.localdomain) # Root is allowed anything exit ;; esac ## WE could enforce any modem or other restrictions here... MODEM=$(GetJobParam modem) if [ $MODEM != "any" ] then # If they've specified a modem, batching will probably ignore # it anyways - we enforce letting us control modem groups. SetControlParam RejectNotice "Modem $MODEM not allowed - use any" exit fi ## Check if job is "approved" - use however you want to do this APPROVED=$(/usr/local/bin/job-moderate-status $JOBID); if [ "$APPROVED" != "SEND" ] then SetControlParam TimeOfDay "$(date +'%H%M-2559' -d 'now + 1 minutes')" exit fi ## Any additional job control settings should follow