summaryrefslogtreecommitdiff
path: root/Build/source/utils/dialog/dialog-1.1-20100428/samples/copifuncs/copi.sendifm1
blob: 564b9c605338399fac184362fbab827025929818 (plain)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#! /bin/sh
##  $Revision: 1.1 $
##  SH script to send UUCP batches out.

##  =()<. @<_PATH_SHELLVARS>@>()=
. ~news/innshellvars

PROGNAME=`basename $0`
LOCK=${LOCKS}/LOCK.${PROGNAME}
LOG=${MOST_LOGS}/${PROGNAME}.log

MAXJOBS=200
UUXFLAGS="- -r -gd"

##  Start logging.
test ! -f ${LOG} && touch ${LOG}
chmod 0660 ${LOG}
exec >>${LOG} 2>&1
echo "${PROGNAME}: [$$] begin `date`"
cd ${BATCH}

##  Anyone else there?
trap 'rm -f ${LOCK} ; exit 1' 1 2 3 15
shlock -p $$ -f ${LOCK} || {
    echo "${PROGNAME}: [$$] locked by [`cat ${LOCK}`]"
    exit 0
}

##  Who are we sending to?
if [ -n "$1" ] ; then
    LIST="$*"
else
    LIST=`ls /usr/spool/news/out.going|egrep "f[0-9]*.n[0-9]*$"`
fi

case ${HAVE_UUSTAT} in
DONT)
    TEMP=${TMPDIR}/uuq$$
    uuq -h |tr -d : >${TEMP}
    ;;
esac

##  Do the work...

for SITE in ${LIST}; do

    ##  See if any data is ready for host.
    BATCHFILE=${SITE}.uucp
    if [ -f ${SITE}.work ] ; then
	cat ${SITE}.work >>${BATCHFILE}
	rm -f ${SITE}.work
    fi
    mv ${SITE} ${SITE}.work
    ctlinnd -s -t30 flush ${SITE} || continue
    cat ${SITE}.work >>${BATCHFILE}
    rm -f ${SITE}.work
    if [ ! -s ${BATCHFILE} ] ; then
	echo "${PROGNAME}: [$$] no articles for ${SITE}"
	rm -f ${BATCHFILE}
	continue
    fi

    ##  Get the compression flags.
    echo "${PROGNAME}: [$$] begin ${SITE}"
    case "${SITE}" in
    phreak)
	COMPRESS="compress"
	;;
    *)
	COMPRESS="gzip"
	;;
    esac

    time batcher \