home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume5 / xenix-poll / poll
Encoding:
Text File  |  1989-02-03  |  1.4 KB  |  76 lines

  1. #!/bin/csh
  2. #
  3. #    useage:    poll sys [sys ...]
  4. #
  5. #        Poll systems given on the command line.
  6. #                
  7. #    History:    10/18/1988    Resurected off of a backup
  8. #                     and hacked to life.    
  9. #                    - R.M. Bownes III
  10. #
  11.  
  12. echo $argv
  13.  
  14. # Check for the presence of a LCK..poll file
  15.  
  16. if (-e /usr/spool/uucp/LCK..poll) then
  17.  
  18. # Look for a currently executing poll.
  19.  
  20.     if (`ps -elf | grep  -c poll` > 0 ) then
  21.         echo "Already a poll in progress"
  22.         exit 
  23.     endif
  24.  
  25. # Look for a currently running uucp.
  26.  
  27.     if (`ps -elf | grep  -c uucico` > 0 ) then
  28.         echo "Already a uucp in progress"
  29.         sleep 300
  30.         exec /usr/lib/uucp/poll
  31.     endif
  32.  
  33. # Guess it didnt exist, LCK..poll must be from before the crash...
  34.  
  35.     rm /usr/spool/uucp/LCK..poll
  36.     rm /usr/spool/uucp/STST*
  37. endif
  38.  
  39. # Look for a user logged in.
  40.  
  41. if (`who | grep  -c tty01` > 0 ) then
  42.     echo `who | grep tty01 | awk -e '{print $1}'` is on tty01
  43.     sleep 300
  44.     exec /usr/lib/uucp/poll
  45. endif
  46.  
  47. # Look for some other uucico going on.
  48.  
  49. #if (`ps -elf | grep -c uucico` > 0 ) then
  50. #    echo `ps -elf | grep uucico ` is currently in progress.
  51. #    sleep 300
  52. #    exec /usr/lib/uucp/poll
  53. #endif
  54.  
  55. # Get ready to dial out.
  56.  
  57. touch /usr/spool/uucp/LCK..poll
  58. disable /dev/tty01
  59.  
  60. # Do the actual uucp
  61.  
  62. while ($1 != "") 
  63.     echo Polling $1
  64.     /usr/lib/uucp/uucico -r1 -s$1
  65.     shift
  66. end
  67.  
  68. # Done with all the uucps, get around the Xenix enable/disable bug.
  69.  
  70. sleep 60
  71. enable tty01
  72.  
  73. # clean up and let us outa here.
  74.  
  75. rm /usr/spool/uucp/LCK..poll
  76.