/usr/lib/news/bin/writelog is in inn 1:1.7.2q-44+b2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | #! /bin/sh
## $Revision: 1.6 $
## Write a log file entry, by either mailing it or writing it safely.
## Usage:
## writelog name text... <input
## where
## name is 'mail' to mail it, or filename to append to.
## =()<. @<_PATH_SHELLVARS>@>()=
. /usr/lib/news/innshellvars
MAXTRY=60
## Parse arguments.
if [ $# -lt 2 ] ; then
echo "usage: $0 'logfile|mail' message ..." 1>&2
exit 1
fi
LOGFILE="$1"
shift
MESSAGE="$@"
## Handle the easy cases.
case "X${LOGFILE}" in
X/dev/null)
exit 0
;;
Xmail)
sed -e 's/^~/~~/' | ${MAILCMD} -s "${MESSAGE}" ${NEWSMASTER}
exit 0
;;
esac
## We're sending to a file.
LOCK=${LOCKS}/LOCK.`basename ${LOGFILE}`
## Remember our PID, in case while is a sub-shell.
PID=$$
TRY=0
export LOCK MAXTRY PID LOGFILE ARTICLE MESSAGE TRY
while [ ${TRY} -lt ${MAXTRY} ]; do
shlock -p ${PID} -f ${LOCK} && break
sleep 2
TRY=`expr ${TRY} + 1`
done
## If we got the lock, update the file; otherwise, give up.
if [ ${TRY} -lt ${MAXTRY} ]; then
echo "${MESSAGE}" >>${LOGFILE}
${SED} -e 's/^/ /' >>${LOGFILE}
echo "" >>${LOGFILE}
rm -f ${LOCK}
else
## This goes to errlog, usually.
echo "$0: Cannot grab lock ${LOCK}, held by:" `cat ${LOCK}` 1>&2
fi
|