home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / util / att-nameserver / xdaemon.rc < prev    next >
Encoding:
Text File  |  1989-06-14  |  1.9 KB  |  71 lines

  1. #ident    "@(#)nameserver:xdaemon.rc    1.1"
  2.  
  3. # Copyright 1988, 1989 AT&T, Inc.
  4. #
  5. # Permission to use, copy, modify, and distribute this software and its
  6. # documentation for any purpose and without fee is hereby granted, provided
  7. # that the above copyright notice appear in all copies and that both that
  8. # copyright notice and this permission notice appear in supporting
  9. # documentation, and that the name of AT&T not be used in advertising
  10. # or publicity pertaining to distribution of the software without specific,
  11. # written prior permission.  AT&T makes no representations about the
  12. # suitability of this software for any purpose.  It is provided "as is"
  13. # without express or implied warranty.
  14. #
  15. # AT&T DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
  16. # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL AT&T
  17. # BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  18. # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  19. # OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 
  20. # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21.  
  22. USAGE="usage: $0 start|stop"
  23.  
  24. if [ $# -ge 1 ]; then
  25.   arg=$1
  26. else
  27.   echo $USAGE 1>&2
  28.   exit 2
  29. fi
  30.  
  31. if [ ! -d /usr/bin ]; then
  32.   exit 2
  33. fi
  34.  
  35. set `who -r`
  36. if [ $8 != "0" ]
  37. then
  38.   exit 2
  39. fi
  40.  
  41. case $arg in
  42.   start)
  43.     for i in `/bin/find /usr/X/lib/net -type d ! -name net -print`
  44.     do
  45.       basename=`basename ${i}`
  46.       if [ -c "/dev/${basename}" ]; then
  47.         have_nets=T
  48.         break
  49.       fi
  50.     done
  51.  
  52.     if [ "${have_nets}" ]; then
  53.       /usr/X/lib/xdaemon &
  54.     fi
  55.     ;;
  56.   stop)
  57.     daemons=`ps -e | grep 'xdaemon[     ]*$' |
  58.              sed 's/^[     ]*\([0-9][0-9]*\)[     ].*/\1/'`
  59.     if [ "${daemons}" ]; then
  60.       kill -15 ${daemons} 2>/dev/null
  61.       sleep 10
  62.       kill -9 ${daemons} 2>/dev/null
  63.     fi
  64.     ;;
  65.   *)
  66.     echo $USAGE 1>&2
  67.     exit 2
  68.     ;;
  69. esac
  70.  
  71.