home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 11.ddi / usr / lib / uucp / Uutry < prev    next >
Encoding:
Text File  |  1990-12-08  |  1.8 KB  |  83 lines

  1. #!/usr/bin/sh
  2. #ident    "@(#)/usr/lib/uucp/Uutry.sl 1.1 4.0 12/08/90 14078 AT&T-USL"
  3.  
  4. export IFS PATH
  5. IFS="     
  6. "
  7. PATH="/usr/bin"
  8.  
  9. #    This shell will start a uucico for the system given.
  10. #    Options:
  11. #      -xN the debugging level for uucico (-x5 default)
  12. #      -r  force the removal of the status file
  13. #    The output is put in /tmp/Name where Name is the name
  14. #    of the system name.  A tail -f is performed after uucico is started.
  15.  
  16. STATUS=/var/uucp/.Status
  17.  
  18. UUCICO=/usr/lib/uucp/uucico
  19. tty -s
  20. if [ "`pwd`" != "/usr/lib/uucp" -a "$?" = 0 -a -x "./uucico" ]; then
  21.     echo "OK to execute uucico from current directory (`pwd`)? y or n? \c"
  22.     read ans
  23.     if [ "$ans" = "y" ]
  24.         then
  25.         UUCICO=./uucico
  26.     fi
  27. fi
  28.  
  29. REMOVE=""
  30. X="-x5"
  31. SYS=
  32. while [ $# -gt 0 ]
  33. do
  34.     case $1 in
  35.     -c)  shift; CLASS="-c$1"; shift;;
  36.     -c*) CLASS="$1"; shift;;
  37.     -x)  shift; X="-x$1"; shift;;
  38.     -x*) X=$1; shift;;
  39.     -r) REMOVE="-f"; shift;;
  40.     -?) echo "$0: unrecognized flag $1\nUSAGE: $0 [-r] [-xdebug_level] system";exit 1;;
  41.     *) SYS="$1"; shift;;
  42.     esac
  43. done
  44.  
  45. if [ -z "$SYS" ]
  46. then
  47.     echo "$0:  system name required"
  48.     exit 1
  49. fi
  50.  
  51. #  check for existence in Systems file
  52. #  only accept match of full name
  53. #  (important because some names may be prefixes of others!)
  54. XX=
  55. XX=`uuname | grep "^${SYS}$" `
  56. if [ -z "$XX" ]
  57. then
  58.     echo "Invalid system name \"$SYS\""
  59.     exit
  60. fi
  61.  
  62. STMP=/tmp/$SYS
  63. rm -f $STMP
  64. > $STMP
  65. chmod 622 $STMP
  66. #  remove old status file (can't actually remove, since $STATUS isn't
  67. #  publicly writable, but zero-ing it out works fine)
  68. if [ -n "$REMOVE" ]; then
  69.     cp /dev/null $STATUS/${SYS} 
  70. fi
  71.  
  72. echo "$UUCICO -r1 -s$SYS $CLASS $REMOVE $X >$STMP 2>&1&"
  73. $UUCICO  -r1 -s$SYS $CLASS $REMOVE $X >$STMP 2>&1&
  74.  
  75. echo "tmp=$STMP"
  76. #    on heavily loaded systems, may take a moment for uucico
  77. #    to create debug file.
  78. if [ ! -f $STMP ]
  79. then
  80.     sleep 5
  81. fi
  82. tail -f $STMP
  83.