Приемы профессиональной работы в UNIX

       

ТЕКСТ ПРОГРАММЫ


1 : 2 # @(#) cuchk v1.0 Check for a free cu line Author: Russ Sage Проверка свободной линии для cu

4 if [ "$#" -gt "0" ] 5 then echo "cuchk: too many arguments" >&2 6 echo "usage: cuchk" >&2 7 exit 1 8 fi

10 while : 11 do 12 ps -e | fgrep cu > /dev/null \ 13 && sleep 5 14 { echo "\ncu is free"; exit; } 15 done &


1 : 2 # @(#) talk v1.0 Talk to the serial port Author: Russ Sage Обращение к последовательному порту

4 BAUD="1200" 5 TTY="tty11" 6 PIPE=""

8 for ARG in $@ 9 do 10 case $ARG in 11 -b*) BAUD="`echo $ARG|cut -c3-`";; 12 -l) echo "logging in /tmp/talk.$$" 13 PIPE="| tee /tmp/talk.$$";; 14 -t*) TTY="tty`echo $ARG|cut -c3-`";; 15 -u) BAUD="9600";; 16 *) echo "talk: invalid argument $ARG" >&2 17 echo "usage: talk [-bBAUD] [-l] [-tTTY] [-u]" >&2 18 echo " -b baud rate" >&2 19 echo " -l log the output" >&2 20 echo " -t use another tty" >&2 21 echo " -u 9600 baud to UNIX" >&2 22 exit 1;; 23 esac 24 done

26 eval cu -s$BAUD -l$TTY dir $PIPE




1 : 2 # @(#) uust v1.0 Uucp status utility Author: Russ Sage

4 if [ $# -gt 0 ] 5 then echo "uust: argument error" >&2 6 echo "usage: uust" >&2 7 exit 1 8 fi

10 UUNODE=`uuname -l` 11 echo " 12 UUST MENU system node: $UUNODE 13 --------- 14 c - connect with another system in debug mode 15 d - show files in your directory under PUBDIR 16 f - long list files in the spool directory 17 l - display the logfile dynamically 18 r - reconnect with another system 19 s - give user summary of transactions 20 u - unlock the tty line 21 w - display logfile for the last week 22 - exit program

24 Press c,d,f,l,r,s,u,w,or : \c" 25 read CMD

27 case $CMD in 28 "") exit 0;; 29 c) echo "\nSystem name ( to exit): \c" 30 read SYSTEM 31 if [ "$SYSTEM" = "" ] 32 then exit 0 33 fi 34 echo "\nrm /usr/spool/uucp/STST.$SYSTEM : \c" 35 rm /usr/spool/uucp/STST.$SYSTEM 2>/dev/null \ 36 && echo "" echo "no STST files" 37 echo "\n/usr/lib/uucp/uucico -r1 -x4 -s$SYSTEM:" 38 /usr/lib/uucp/uucico -r1 -x4 -s$SYSTEM;; 39 d) echo "\n/usr/spool/uucppublic/$LOGNAME:" 40 ls -l /usr/spool/uucppublic/$LOGNAME;; 41 f) echo "\n/usr/spool/uucp:" 42 ls -l /usr/spool/uucp | more;; 43 l) echo "\n/usr/spool/uucp/LOGFILE:" 44 tail -20f /usr/spool/uucp/LOGFILE;; 45 r) echo "\nSystem name ( to exit): \c" 46 read SYSTEM 47 if [ "$SYSTEM" = "" ] 48 then exit 0 49 fi 50 echo "\nrm /usr/spool/uucp/STST.$SYSTEM : \c" 51 rm /usr/spool/uucp/STST.$SYSTEM 2>/dev/null \ 52 && echo "" echo "no STST files" 53 echo "uusub -c$SYSTEM:" 54 if [ -f /xenix ] 55 then /usr/bin/uusub -c$SYSTEM 56 else /usr/lib/uucp/uusub -c$SYSTEM 57 fi 58 tail -20f /usr/spool/uucp/LOGFILE;; 59 s) echo "\nuulog -u$LOGNAME:" 60 uulog -un$LOGNAME | more;; 61 u) echo \\nrm /usr/spool/uucp/LCK* : 62 rm /usr/spool/uucp/LCK* 2>/dev/null echo "no lock files";; 63 w) echo "\n/usr/spool/uucp/Log-WEEK:" 64 more /usr/spool/uucp/Log-WEEK;; 65 *) echo "uust: invalid argument '$CMD'" >&2;; 66 esac




1 : 2 # @(#) uutrans v1.0 Transfer file trees via uucp 3 # Author: Russ Sage 4 if [ $# -gt 0 ] 5 then echo "uutrans: argument count error" >&2 6 echo "usage: uutrans" >&2 7 exit 1 8 fi

10 SELF=`uuname -l`

12 echo "source directory( to exit): \c" 13 read SOURCE 14 if [ "$SOURCE" = "" -o ! -d "$SOURCE" ] 15 then exit 1 16 fi

18 echo "\ndestination system( for $SELF): \c" 19 read SYSTEM 20 echo "\ndestination directory( for ~/$LOGNAME): \c" 21 read DEST



23 : ${SYSTEM:="$SELF"} 24 : ${DEST:="~/$LOGNAME"}

26 echo "\nQUEUEING:"

28 find $SOURCE -type f -print | sort | while read FILE 29 do 30 echo $FILE 31 uucp -c -d -r $FILE $SYSTEM!$DEST/$FILE 32 done



Содержание раздела