news.daily and dropped innfeed files
Julien ÉLIE
julien at trigofacile.com
Wed Apr 29 20:28:43 UTC 2009
Hi Russ,
>>> I wonder if it would be useful to have news.daily process dropped
>>> innfeed files automatically via procbatch.
>>
>> That would be lovely.
>
> The only tricky part, which is what always stopped me from automating
> something, was that you have to be sure the old innfeed is dead before
> you can process the *.dropped file.
I think something like that should work in news.daily:
# Try to find the path to innfeed's spool. The default is
# ${PATHSPOOL}/innfeed if not found.
INNFEEDSPOOL=`${AWK} '{gsub(/:|#/, " & ")} {if ($1 == "backlog-directory" && $2 == ":") print $3}' ${PATHETC}/innfeed.conf`
test -z "${INNFEEDSPOOL}" && test -f "${PATHSPOOL}/innfeed" && INNFEEDSPOOL="innfeed"
if [ -d "${PATHSPOOL}/${INNFEEDSPOOL}" ]
then
cd "${PATHSPOOL}/${INNFEEDSPOOL}"
# Find the PIDs of innfeed.
LOCKS=`cat *.lock | ${SORT} -u`
# Process files like "innfeed-dropped.A001703" where
# 1703 is not in $LOCKS.
for file in $(find -name "innfeed-dropped*")
do
PID=`echo "$file" | ${SED} 's/^.*[A-Z]0*//'`
FOUND=false
for LOCK in $LOCKS
do
if [ "$PID" = "$LOCK" ]
then
FOUND=true
fi
done
if [ $FOUND = false ]
then
${PATHBIN}/procbatch -qmu $file
fi
done
fi
$LOCKS contains "1703 392" for instance.
$file is "innfeed-dropped.A001703".
$PID is 1703 and then this file is not processed.
I hope it is portable.
--
Julien ÉLIE
« Mais pourquoi courent-ils si vite ? Pour gagner du temps ! Comme le temps,
c'est de l'argent... plus ils courent vite, plus ils en gagnent. » (Raymond Devos)
More information about the inn-workers
mailing list