home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / pub / public_html / cudocs / ilodomany < prev    next >
Text File  |  2020-01-01  |  3KB  |  84 lines

  1. #!/p/sy/subsys/scripts/wermit +
  2. #!/p/kd/fdc/solaris9/wermit +
  3. #!/p/kd/fdc/RHEL4/wermit +
  4. #
  5. # IMPORTANT: The first line must indicate the path to C-Kermit 8.0.212
  6. #  and must be followed by a plus sign (separated by whitespace).
  7. #
  8. # ilodomany: C-Kermit script to invoke ilosetup on a series of HP servers.
  9. #   The names of the servers are on the command line.  Prompts once for the
  10. #   created-user password and uses it on all the servers.
  11. # author: Frank da Cruz, Columbia University, 2009
  12. #
  13. .version = 1.04
  14. #   Created:  
  15. #    1.01 20090428
  16. #   Modified:
  17. #    1.04 20091211: Allow passing of options to ilosetup
  18. #    1.03 20091104: Fix bugs in ASK/ASKQ prompting;
  19. #                   Work around limitation in PUTENV (*)
  20. #    1.02 20090916: prompt for created user ID as well as password
  21. #
  22. # (*) In C-Kermit 8.0.212 only one environment variable could be passed;
  23. #     in C-Kermit 9.0, any number can passed.
  24. #
  25. # quitonerror 0 means if an ilosetup invocation fails for any reason,
  26. # go ahead and do the next one (if any) regardless.  Nonzero means
  27. # stop immediately and not do any more.
  28.  
  29. .quitonerror = 0             # Set to nonzero if desired
  30.  
  31. .myname := \fbasename(\v(cmdfile))    # Name of this script without path
  32. if < \v(version) 800212 {
  33.     exit 1 "\m(myname): C-Kermit 8.0.212 or later required"
  34. }
  35. if llt "\v(build)" "20070830" {
  36.     # This is required for PUTENV
  37.     exit 1 "\m(myname): 20070830 or later required"
  38. }
  39. if not def \%1 exit 1 "Usage: \m(myname) hostname hostname hostname ..."
  40.  
  41. undef ilo_options
  42. for i 1 \v(argc)-1 1 {
  43.     if == 1 \findex(options=,\&_[i]) {
  44.         .ilo_options := \m(ilo_options) \fsubstr(\&_[i],9)
  45.         undef \&_[i]
  46.     }        
  47. }
  48. .exedir := \fdirname(\v(cmdfile))    # Directory where this script is
  49. if def \$(DEBUG) {            # dev/test
  50.     show mac myname exedir
  51.     show args    
  52. }
  53. cd \m(exedir)                # CD to script's directory
  54. if fail exit 1 "\m(myname): cd \m(exedir)"
  55. if not exist ./ilosetup exit 1 "\m(myname): \m(exedir)ilosetup not found"
  56.  
  57. undef userid                # Prompt for created-user ID
  58. while not def userid {
  59.     ask userid "User ID for created accounts: "
  60. }
  61. undef userpass                # Prompt for created-user password
  62. while not def userpass {
  63.     askq /echo:* userpass "Password to set on created accounts: "
  64. }
  65. # Note: in C-Kermit 9.0 we can do two putenvs and we don't have to pass
  66. # the user ID to ilosetup in the open on the command line.
  67.  
  68. for i 1 \v(argc) 1 {
  69.     if def \%1 {
  70.     if def \$(DEBUG) echo "DOING \%1..."
  71.     putenv ilo_userpass \m(userpass) # Must do this each time
  72.         ! ilo_userid=\m(userid) ./ilosetup \%1 \m(ilo_options)
  73.     if fail if \m(quitonerror) exit 1 "FAILED: ilosetup [\%1]"
  74.     }
  75.     shift                # Next host name
  76. }
  77. exit 0
  78.  
  79. ; Local Variables:
  80. ; comment-column:40
  81. ; comment-start:"# "
  82. ; End:
  83.