#ident "@(#)/usr/local/sysadmin/FILEMGR 1.0 03/18/91" Author: Mr Reinhard Pfaffinger
# Office: 1924 CSS/SDA, Randolph AFB, Texas 78150
# Phone: AV 487-8649  Comm: (512) 652-8649
#
# This script allows the system administrator to manage the file system.
#

chkfortty() {
             if [ "$TERM" = "tty" ]
               then
                   echo  
             else
                 tput clear 
             fi
            }

rtn() {
       echo "\nPress <RETURN> ... \c"
       read RTN
      }

while :
 do
   chkfortty
   echo "                   <<< AT&T 3B2/600G File Management Menu >>>\n"
   echo "                       1. Complete Backup (Entire File System)"
   echo "                       2. Selective Backup (to SCSI QIC Tape/Floppy)" 
   echo "                       3. Restore (from SCSI QIC Tape/Floppy)"
   echo "                       4. File System Status"
   echo "                       5. File Age (by directory)"
   echo "                       6. File Size (by directory)\n"
   echo "				q or Q to quit\n"
   echo "			   Enter response <RETURN> =>> \c"
   read RESP
   case "$RESP" in
      1)
        chkfortty
        /usr/local/backup c
        ;;
      2)
        chkfortty
        /usr/local/backup
        continue
        ;;
      3)
        chkfortty
        echo "\t\t\tFrom which device do you wish to restore?\n"
        echo "\t\t\t\t1. SCSI QIC Tape"
        echo "\t\t\t\t2. Floppy Diskette\n"
        echo "\t\t\t\tq or Q to quit\n"
        echo "\t\t\tEnter response <RETURN> =>> \c"
        read RESTORE
        case "$RESTORE" in
           1)
             OPT="-icduv"
             chkfortty
             echo "\nBeginning restore from /dev/rSA/qtape1 ... \n"
             cpio $OPT < /dev/rSA/qtape1
             ;;
           2)
             chkfortty
             echo "Mount the floppy diskette into the drive and press <RETURN> =>> \c"
             read RTN
             echo "\nBeginning restore from /dev/diskette ... \n"
             cpio -icduv < /dev/diskette
             ;;
           *)
             continue
             ;; 
        esac 
        rtn
        continue
        ;;
      4)
        chkfortty
        echo "\t\t\tSelect one of the following options:\n"
        echo "\t\t\t\t1. Volume Status"
        echo "\t\t\t\t2. DFSpace"
        echo "\t\t\t\t3. ByteCount\n"
        echo "\t\t\t\tq or Q to quit\n"
        echo "\t\t\tEnter response <RETURN> =>> \c"
        read VOLSTAT
        case "$VOLSTAT" in
           1)
             /usr/local/volumestatus
             rtn
             ;;
           2)
             /usr/local/dfspace
             rtn
             ;;
           3)
             chkfortty
             echo "Enter a full directory path name specification <RETURN> =>> \c"
             read DIRFILE
             /usr/local/bytecount $DIRFILE
             rtn
             ;;
        esac
        continue
        ;;
      5)
        chkfortty
        sysadm fileage
        rtn
        continue
        ;;
      6)
        /usr/local/bigfiles
        rtn
        continue
        ;;
    q|Q)
        exit 0
        ;;
      *)
        echo "\n\t\t\t\tInvalid response!\c"
        sleep 2
        continue
        ;;
  esac
 done
