2 # fixscript will replace this line with code to load innshellvars
5 ## Write a log file entry, by either mailing it or writing it safely.
7 ## writelog name text... <input
9 ## name is 'mail' to mail it, or filename to append to.
14 if [ $# -lt 2 ] ; then
15 echo "usage: $0 'logfile|mail' message ..." 1>&2
22 ## Handle the easy cases.
28 sed -e 's/^~/~~/' | ${MAILCMD} -s "${MESSAGE}" ${NEWSMASTER}
33 ## We're sending to a file.
34 LOCK=${LOCKS}/LOCK.`basename ${LOGFILE}`
36 ## Remember our PID, in case while is a sub-shell.
40 export LOCK MAXTRY PID LOGFILE ARTICLE MESSAGE TRY
41 while [ ${TRY} -lt ${MAXTRY} ]; do
42 shlock -p ${PID} -f ${LOCK} && break
47 ## If we got the lock, update the file; otherwise, give up.
48 if [ ${TRY} -lt ${MAXTRY} ]; then
49 echo "${MESSAGE}" >>${LOGFILE}
50 ${SED} -e 's/^/ /' >>${LOGFILE}
54 ## This goes to errlog, usually.
55 echo "$0: Cannot grab lock ${LOCK}, held by:" `cat ${LOCK}` 1>&2