#!/bin/sh ## ## news-cancel ## ## Made by stransky ## Login stransky ## ## Started on dim 13 jan 2002 02:30:56 CET Nicolas STRANSKY ## Last update ven 25 jan 2002 08:53:48 CET Nicolas STRANSKY ## ## Script pour annuler ou modérer un message de news. # # TODO : implémenter la possibilité de définir le message par un NG et un numéro. VERIF () { ligne=`grep --binary-files=text " "$1" " /var/spool/news/overview/OV1 | head -n 1 | awk -F "\t" '{print $1"~"$2"~"$3"~"$9}'` numero=`echo $ligne | awk -F "~" '{print $1}'` auteur=`echo $ligne | awk -F "~" '{print $3}'` titre=`echo $ligne | awk -F "~" '{print $2}'` newsgroup=`echo $ligne | awk -F "~" '{print $4}' | awk '{print $3}' | awk -F : '{print $1}'` echo "il s'agit du message $titre, numéro $numero, posté par $auteur dans $newsgroup" echo "" echo -n "exact ? [o/n] " read confirmation case $confirmation in o*|O*) ;; *) echo "on ne fait rien" exit 0 ;; esac } SAUVEGARDE () { echo "sauvegarde du mail dans /root/moderes/ ? [o/n] " read reponse case $reponse in o*|O*) rep=`echo $newsgroup | sed 's/\./\//g'` cp /var/spool/news/articles/$rep/$numero /root/moderes/$newsgroup'.'$numero ;; *) echo "on ne fait rien" exit 0 ;; esac } EDITION () { $EDITOR /var/spool/news/articles/$rep/$numero } CANCEL () { echo -n 'throttling inn... ' /bin/su - news -c "/usr/lib/news/bin/ctlinnd throttle 'article canceling'" echo "canceling article $1" /bin/su - news -c "/usr/lib/news/bin/ctlinnd cancel $1" echo -n 'starting inn... ' /bin/su - news -c "/usr/lib/news/bin/ctlinnd go ''" } if [ $UID -eq 0 ] then case $1 in \<*@*\>) VERIF $1 SAUVEGARDE echo "edition ou annulation du message ? [E/A] " read action case $action in e*|E*) EDITION ;; a*|A*) CANCEL \'$1\' ;; *) echo "attention, il n'y a eu ni édition ni annulation. relancer le script" ;; esac ;; *) echo "usage : news-cancel ''" ;; esac else echo "You must be root to launch this command." exit 1 fi