#!/bin/sh # # faxrm # # remove faxes with job_id passed on the command line (if writable) # # There are still a lot rough edges - but it works, and should give you an # idea how to improve it # # SCCS: $Id$ Copyright (C) 1994 Gert Doering FAX_SPOOL=/var/spool/fax FAX_SPOOL_OUT=/var/spool/fax/outgoing # # echo program that will accept escapes (bash: "echo -e", sun: /usr/5bin/echo) echo="echo" # # helper program for privileged queue access FAXQ_HELPER=/usr/bin/faxq-helper # if [ ! -d $FAX_SPOOL_OUT ] then echo "$FAX_SPOOL_OUT does not exist" >&2 exit 1 fi cd $FAX_SPOOL_OUT interactive="" if [ "X$1" = "X-i" ] then interactive="i" shift fi if [ $# -eq 0 ] then echo "usage: faxrm [-i] job-id ..." exit 1 fi for jobid do if [ ! -d "$jobid" ] then echo "$jobid: no such job found." >&2 continue fi # # check lock (there's a small race here, but this is only informational # anyway - the real locking is inside the helper) if [ -f "$jobid"/JOB.locked ] then echo "$jobid: JOB is locked, try again later." >&2 continue fi # # throw away - faxq-helper will do all the checks & all the work # $FAXQ_HELPER remove $jobid # # end for (all jobs) done