chiark / gitweb /
bin: Drop 'use diagnostics;' from all Perl scripts.
[bin.git] / plonk
1 #! /bin/bash
2
3 # Killfile a luser in some newsgroup, optionally specifying a time to
4 # give the luser a chance of a reprieve.
5
6 # First parameter is the luser to killfile.
7 # Second parameter is the newsgroup in which to killfile said luser.
8 # Third and further parameters, if present, specify a time at which to
9 # mail a message offering the luser a reprieve. Example time
10 # specifications are "now + 1 week" and "8pm Nov 6"; see at(1) for
11 # more details.
12
13 exec 1>&2       # Everything goes to standard error
14
15 if [ "X$1" == "X" -o "X$2" == "X" ]; then
16         echo "Usage: $0 victim newsgroup [ time-spec ]"
17         exit 1
18 fi
19
20 VICTIM=$1
21 NEWSGROUP=$2
22 KILLFILE="$HOME/News/`echo $NEWSGROUP | tr . /`/KILL"
23
24 if [ ! -f $KILLFILE ]; then
25         echo "Killfile for $NEWSGROUP not found"
26         exit 1
27 fi
28
29 echo "/$VICTIM/f:j" >> $KILLFILE
30
31 shift 2
32
33 if [ "X$1" != "X" ]; then
34         echo "$HOME/bin/reprieve \"$VICTIM\" $NEWSGROUP \"`date`\"" | /usr/bin/at "$*" 2>/dev/null
35 fi