2 # fixscript will replace this line with code to load innshellvars
5 ## Tally/update the newgroup/rmgroup control log.
6 ## Merge in a log that contains newgroup/rmgroup control messages so that
7 ## the "control.log" file is updated to contain the new counts of how
8 ## often each group has been newgroup'd or rmgroup'd. This is run by
9 ## scanlogs, which prepares this from the control-message handlers if
10 ## control.ctl specifies logging.
12 CONTROL=${MOST_LOGS}/control.log
13 CONTROL_NEW=${CONTROL}.new
14 CONTROL_OLD=${CONTROL}.old
16 PROGNAME=`basename $0`
17 LOCK=${LOCKS}/LOCK.${PROGNAME}
20 trap 'rm -f ${LOCK} ; exit 1' 1 2 3 15
21 shlock -f ${LOCK} -p $$ || {
22 echo "$0: cannot lock ${LOCK}" 1>&2
27 if [ ! -f ${CONTROL} ]; then
31 rm -f ${CONTROL_NEW} ${CONTROL_OLD}
32 ln ${CONTROL} ${CONTROL_OLD}
34 chmod 0660 ${CONTROL_NEW}
37 ${SED} -n -e 's/[ ][ ]*/ /g' -e 's/^ \(Control:.*\)$/1 \1/p' \
39 | ${SED} -e 's/ /#/g' -e 's/\([0-9][0-9]*\)#\(.*\)/\1 \2/' \
49 print ctl[line], line;
54 | sort -n -r >${CONTROL_NEW}
55 mv -f ${CONTROL_NEW} ${CONTROL}