home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 300-399 / ff319.lzh / CNewsSrc / cnews.orig.lzh / misc / delgroup < prev    next >
Text File  |  1989-06-27  |  947b  |  50 lines

  1. #! /bin/sh
  2. # delgroup - delete a newsgroup, locally only
  3.  
  4. # =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
  5. . ${NEWSCONFIG-/usr/lib/news/bin/config}
  6.  
  7. PATH=$NEWSCTL/bin:$NEWSBIN/maint:$NEWSBIN:$NEWSPATH ; export PATH
  8. umask $NEWSUMASK
  9.  
  10. usage="Usage: $0 groupname"
  11.  
  12. case $# in
  13. 1)    ;;
  14. *)    echo "$usage" >&2 ; exit 2    ;;
  15. esac
  16.  
  17. case "$1" in
  18. */*)    echo "$usage" >&2 ; exit 2    ;;
  19. esac
  20.  
  21. already="`sed 's/[     ].*//' $NEWSCTL/active | fgrep -x \"$1\"`"
  22. if test " $already" = " "
  23. then
  24.     echo "$0: $1 appears not to exist" >&2
  25.     exit 1
  26. fi
  27.  
  28. lock="$NEWSCTL/LOCK"
  29. ltemp="$NEWSCTL/L.$$"
  30. echo $$ >$ltemp
  31. trap "rm -f $ltemp ; exit 0" 0 1 2 15
  32. while true
  33. do
  34.     if newslock $ltemp $lock
  35.     then
  36.         trap "rm -f $ltemp $lock ; exit 0" 0 1 2 15
  37.         break
  38.     fi
  39.     echo 'news system locked, waiting...'
  40.     sleep 5
  41. done
  42.  
  43. cd $NEWSCTL
  44.  
  45. awk "\$1 != \"$1\"" active >active.tmp
  46. mv active active.old && mv active.tmp active
  47.  
  48. echo "You may wish to rm -rf $NEWSARTS/`echo "$1" | sed 's;\.;/;g'` at some poi
  49. t."
  50.