chiark / gitweb /
Merge; also move moderators from master/
[modbot-mtm.git] / inews.test
1 #!/bin/sh
2 set -e
3
4 #real=false
5 real=true
6
7 export NNTPSERVER=nnrp.chiark.greenend.org.uk
8 export NNTPAUTH='md5cookie1way chiark'
9
10 trap 'rm -f "$tf"' 0
11
12 tf=`mktemp`
13
14 sed '${ /^$/d }' >$tf
15
16 set +e
17 output=`
18         set -e
19         exec 2>&1
20         if $real; then
21                 inews -h -Q -R <$tf
22         else
23                 (set -e
24                  echo "Newsgroups: chiark.test.moderated"
25                  sed 's/^Newsgroups:/X-Would-Newsgroups:/' $tf) | inews -h
26         fi
27 `
28 rc=$?
29 set -e
30
31 if [ $rc = 0 ]
32 then
33         echo 'posted ok!'
34         $HOME/live/xlog/bin/record posted uk.rec.cycling.moderated <$tf
35         exit 0
36 fi
37
38 (
39         printf "Errors: %s" "$output"
40         echo
41         echo ======================
42         cat $tf
43 ) | mail -s 'lost moderated newsgroup submission' webstump