diff --git a/news-cancel b/news-cancel index 2f02a219..fceadfea 100755 --- a/news-cancel +++ b/news-cancel @@ -6,12 +6,18 @@ ## Login stransky ## ## Started on dim 13 jan 2002 02:30:56 CET Nicolas STRANSKY -## Last update mer 27 fév 2002 02:28:58 CET Nicolas STRANSKY +## Last update mer 03 avr 2002 23:15:46 CEST 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. +if [[ "${ORIG_LOGNAME-$SUDO_USER}" = "" ]] + then moderateur=`who am i | awk '{print $1}'` + else moderateur=${ORIG_LOGNAME-$SUDO_USER} +fi + +groupe=adm VERIF () { ligne=`grep --binary-files=text " $1 " /var/spool/news/overview/OV1 | head -n 1 | awk -F "\t" '{print $1"~"$2"~"$3"~"$9}'` @@ -40,12 +46,12 @@ SAUVEGARDE () { sleep 1 rep=`echo $newsgroup | sed 's/\./\//g'` cp /var/spool/news/articles/$rep/$numero /root/moderes/$newsgroup'.'$numero.nws - moderateur=`who am i | awk '{print $1}'` echo "$1 de $newsgroup.$numero" > /tmp/news-cancel1.txt echo " " >> /tmp/news-cancel1.txt echo "modérateur : $moderateur" >> /tmp/news-cancel1.txt echo "commentaires : " > /tmp/news-cancel-commentaires.txt - $EDITOR /tmp/news-cancel-commentaires.txt + chown $moderateur.$groupe /tmp/news-cancel-commentaires.txt + /bin/su $moderateur -c "$EDITOR /tmp/news-cancel-commentaires.txt" cat /tmp/news-cancel-commentaires.txt >> /tmp/news-cancel1.txt cat /tmp/news-cancel1.txt | mutt -nx -a /root/moderes/$newsgroup'.'$numero.nws -s "moderation de $newsgroup.$numero par $moderateur" moderateurs rm -f /tmp/news-cancel* @@ -54,17 +60,18 @@ SAUVEGARDE () { EDITION () { - $EDITOR /var/spool/news/articles/$rep/$numero + chown $moderateur.$groupe /var/spool/news/articles/$rep/$numero + /bin/su $moderateur -c "$EDITOR /var/spool/news/articles/$rep/$numero" } CANCEL () { 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" - /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 ''" + /bin/su news -c "/usr/lib/news/bin/ctlinnd go ''" }