home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / news / cnews.tar / maint / delgroup < prev    next >
Text File  |  1994-08-17  |  861b  |  40 lines

  1. #! /bin/sh
  2. # delgroup - delete a newsgroup, locally only
  3.  
  4. # =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
  5. . ${NEWSCONFIG-/etc/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="`awk '\$1 == \"'"$1"'\"' $NEWSCTL/active`"
  22. if test " $already" = " "
  23. then
  24.     echo "$0: $1 appears not to exist" >&2
  25.     exit 1
  26. fi
  27.  
  28. lock -v LOCK $$ 5 || exit 1
  29. trap "unlock LOCK ; trap 0 ; exit 0" 0 1 2 15
  30.  
  31. cd $NEWSCTL
  32.  
  33. awk "\$1 != \"$1\"" active >active.tmp
  34. mv active active.save && mv active.tmp active && rm active.save
  35. awk "\$1 != \"$1\"" active.times >active.times.t
  36. mv active.times active.times.s && mv active.times.t active.times &&
  37.     rm active.times.s
  38.  
  39. echo "$1" | sed 's;\.;/;g' >>dirs.tbd
  40.