chiark / gitweb /
Send webstump CGI logs to "errs" too to capture all of the decisions
[modbot-mtm.git] / inews.INO
1 #!/bin/sh
2 set -e
3
4 export NNTPSERVER=nnrp.chiark.greenend.org.uk
5 export NNTPAUTH='md5cookie1way chiark'
6
7 trap 'rm -f "$tf"' 0
8
9 tf=`mktemp`
10
11 sed '${ /^$/d }' >$tf
12
13 set +e
14 output=`
15         set -e
16         exec 2>&1
17         if [ x%DIVERTPOSTINGS% = x ]; then
18                 inews -h -Q -R <$tf
19         else
20                 (set -e
21                  echo "Newsgroups: %DIVERTPOSTINGS%"
22                  sed 's/^Newsgroups:/X-Would-Newsgroups:/' $tf) | inews -h
23         fi
24 `
25 rc=$?
26 set -e
27
28 if [ $rc = 0 ]
29 then
30         echo 'posted ok!'
31         %BASEDIR%/xlog/bin/record posted %GROUP% <$tf
32         exit 0
33 fi
34
35 (
36         printf "Errors: %s" "$output"
37         echo
38         echo ======================
39         cat $tf
40 ) | mail -s 'lost moderated newsgroup submission' webstump