V2 : utilisation de control cancel et supersede via telnet
darcs-hash:20020427163500-a279a-dab6aba6168a995a1ecbc009bb56d9e81c0bd0ea.gz
This commit is contained in:
parent
d13748dc17
commit
bf47e85a79
1 changed files with 36 additions and 25 deletions
61
news-cancel
61
news-cancel
|
@ -6,11 +6,14 @@
|
||||||
## Login stransky <stransky@crans.org>
|
## Login stransky <stransky@crans.org>
|
||||||
##
|
##
|
||||||
## Started on dim 13 jan 2002 02:30:56 CET Nicolas STRANSKY
|
## Started on dim 13 jan 2002 02:30:56 CET Nicolas STRANSKY
|
||||||
## Last update mer 03 avr 2002 23:15:46 CEST Nicolas STRANSKY
|
## Last update sam 27 avr 2002 00:56:25 CEST Nicolas STRANSKY
|
||||||
##
|
##
|
||||||
## Script pour annuler ou modérer un message de news.
|
## 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.
|
## V 1.0 : utilisation de la commande ctlinnd cancel.
|
||||||
|
## V 2.0 : utilisation des commandes control cancel et supersede pour assurer
|
||||||
|
## la propagation des modifications effectuées.
|
||||||
|
|
||||||
|
|
||||||
if [[ "${ORIG_LOGNAME-$SUDO_USER}" = "" ]]
|
if [[ "${ORIG_LOGNAME-$SUDO_USER}" = "" ]]
|
||||||
then moderateur=`who am i | awk '{print $1}'`
|
then moderateur=`who am i | awk '{print $1}'`
|
||||||
|
@ -18,6 +21,9 @@ if [[ "${ORIG_LOGNAME-$SUDO_USER}" = "" ]]
|
||||||
fi
|
fi
|
||||||
|
|
||||||
groupe=adm
|
groupe=adm
|
||||||
|
tempF=$(tempfile -d /tmp -p "news-cancel")
|
||||||
|
tempF2=$(tempfile -d /tmp -p "news-cancel-commentaire")
|
||||||
|
tempF3=$(tempfile -d /tmp -p "news-cancel-message")
|
||||||
|
|
||||||
VERIF () {
|
VERIF () {
|
||||||
ligne=`grep --binary-files=text " $1 " /var/spool/news/overview/OV1 | head -n 1 | awk -F "\t" '{print $1"~"$2"~"$3"~"$9}'`
|
ligne=`grep --binary-files=text " $1 " /var/spool/news/overview/OV1 | head -n 1 | awk -F "\t" '{print $1"~"$2"~"$3"~"$9}'`
|
||||||
|
@ -46,37 +52,42 @@ SAUVEGARDE () {
|
||||||
sleep 1
|
sleep 1
|
||||||
rep=`echo $newsgroup | sed 's/\./\//g'`
|
rep=`echo $newsgroup | sed 's/\./\//g'`
|
||||||
cp /var/spool/news/articles/$rep/$numero /root/moderes/$newsgroup'.'$numero.nws
|
cp /var/spool/news/articles/$rep/$numero /root/moderes/$newsgroup'.'$numero.nws
|
||||||
echo "$1 de $newsgroup.$numero" > /tmp/news-cancel1.txt
|
echo "$1 de $newsgroup.$numero" > $tempF
|
||||||
echo " " >> /tmp/news-cancel1.txt
|
echo " " >> $tempF
|
||||||
echo "modérateur : $moderateur" >> /tmp/news-cancel1.txt
|
echo "modérateur : $moderateur" >> $tempF
|
||||||
echo "commentaires : " > /tmp/news-cancel-commentaires.txt
|
echo "commentaires : " > $tempF2
|
||||||
chown $moderateur.$groupe /tmp/news-cancel-commentaires.txt
|
chown $moderateur.$groupe $tempF2
|
||||||
/bin/su $moderateur -c "$EDITOR /tmp/news-cancel-commentaires.txt"
|
/bin/su $moderateur -c "$EDITOR $tempF2"
|
||||||
cat /tmp/news-cancel-commentaires.txt >> /tmp/news-cancel1.txt
|
cat $tempF2 >> $tempF
|
||||||
cat /tmp/news-cancel1.txt | mutt -nx -a /root/moderes/$newsgroup'.'$numero.nws -s "moderation de $newsgroup.$numero par $moderateur" moderateurs
|
echo "Envoi du mail aux modérateurs..."
|
||||||
rm -f /tmp/news-cancel*
|
cat $tempF | mutt -nx -a /root/moderes/$newsgroup'.'$numero.nws -s "moderation de $newsgroup.$numero par $moderateur" moderateurs@crans.org
|
||||||
|
rm -f $tempF $tempF2
|
||||||
echo " "
|
echo " "
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EDITION () {
|
EDITION () {
|
||||||
chown $moderateur.$groupe /var/spool/news/articles/$rep/$numero
|
cp /var/spool/news/articles/$rep/$numero $tempF3
|
||||||
/bin/su $moderateur -c "$EDITOR /var/spool/news/articles/$rep/$numero"
|
chown $moderateur.$groupe $tempF3
|
||||||
|
/bin/su $moderateur -c "$EDITOR $tempF3"
|
||||||
|
(sleep 1 ; echo "mode reader" ; sleep 1 ; echo "group $newsgroup" ; sleep 1 ; echo post ; sleep 1 ; echo "Supersedes: $1" ; cat $tempF3 | egrep -v "^Message-ID:|^NNTP-Posting|^Path:|^X-Trace:|^X-Complaints-To:|^Xref:" ; echo '.' ; sleep 1 ; echo quit) | nc 138.231.136.6 119
|
||||||
|
rm -f $tempF3
|
||||||
}
|
}
|
||||||
|
|
||||||
CANCEL () {
|
CANCEL () {
|
||||||
echo -n 'throttling inn... '
|
# echo -n 'throttling inn... '
|
||||||
/bin/su news -c "/usr/lib/news/bin/ctlinnd throttle 'article canceling'"
|
# /bin/su news -c "/usr/lib/news/bin/ctlinnd throttle 'article canceling'"
|
||||||
echo "canceling article $1"
|
# echo "canceling article $1"
|
||||||
/bin/su news -c "/usr/lib/news/bin/ctlinnd cancel $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 ''"
|
||||||
|
|
||||||
echo -n 'starting inn... '
|
(sleep 1 ; echo "mode reader" ; sleep 1 ; echo "group $newsgroup" ; sleep 1 ; echo post ; sleep 1 ; echo "Control: cancel $1" ; echo "From: $moderateur@crans.org" ; echo "Subject: Moderation" ; echo "Newsgroups: $newsgroup" ; echo -e "\n" ; echo "This post has been moderated with news-cancel." ; echo '.' ; sleep 1 ; echo quit) | nc 138.231.136.6 119
|
||||||
/bin/su news -c "/usr/lib/news/bin/ctlinnd go ''"
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if [ $UID -eq 0 ]
|
if [ $UID -eq 0 ]
|
||||||
then
|
then
|
||||||
case $1 in
|
case $1 in
|
||||||
|
@ -87,11 +98,11 @@ then
|
||||||
case $action in
|
case $action in
|
||||||
e*|E*)
|
e*|E*)
|
||||||
SAUVEGARDE Edition
|
SAUVEGARDE Edition
|
||||||
EDITION
|
EDITION $1
|
||||||
;;
|
;;
|
||||||
a*|A*)
|
a*|A*)
|
||||||
SAUVEGARDE Annulation
|
SAUVEGARDE Annulation
|
||||||
CANCEL \'$1\'
|
CANCEL $1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "attention, il n'y a eu ni édition ni annulation. relancer le script"
|
echo "attention, il n'y a eu ni édition ni annulation. relancer le script"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue