home *** CD-ROM | disk | FTP | other *** search
/ ftp.pasteur.org/FAQ/ / ftp-pasteur-org-FAQ.zip / FAQ / aix-faq / part5 < prev   
Encoding:
Internet Message Format  |  2000-11-03  |  55.3 KB

  1. Path: senator-bedfellow.mit.edu!bloom-beacon.mit.edu!howland.erols.net!newsfeed.skycache.com!Cidera!nntp-out.teleweb.pt!news.teleweb.pt!not-for-mail
  2. From: bofh@mail.teleweb.pt
  3. Newsgroups: comp.unix.aix,comp.answers,news.answers
  4. Subject: comp.unix.aix Frequently Asked Questions (Part 5 of 5)
  5. Supersedes: <aix-faq-5-973024721@mail.teleweb.pt>
  6. Followup-To: comp.unix.aix
  7. Date: 2 Nov 2000 16:02:24 +0100
  8. Organization: What ?
  9. Lines: 1841
  10. Approved: news-answers-request@mit.edu
  11. Distribution: world
  12. Expires: 07 Dec 2000 15:25:21
  13. Message-ID: <aix-faq-5-973175121@mail.teleweb.pt>
  14. References: <aix-faq-1-973175121@mail.teleweb.pt>
  15. Reply-To: bofh@mail.teleweb.pt (Jose Pina Coelho)
  16. NNTP-Posting-Host: p140a55.teleweb.pt
  17. X-Trace: srvlis16.teleweb.pt 973177891 1579 212.16.140.55 (2 Nov 2000 15:11:31 GMT)
  18. X-Complaints-To: abuse@teleweb.pt
  19. NNTP-Posting-Date: 2 Nov 2000 15:11:31 GMT
  20. Summary: This posting contains AIX Frequently Asked Questions
  21.          and their answers.  AIX is IBM's version of Unix.
  22. Keywords: AIX RS/6000 questions answers
  23. Xref: senator-bedfellow.mit.edu comp.unix.aix:191695 comp.answers:42950 news.answers:195012
  24.  
  25. Posted-By: auto-faq 3.3 (Perl 5.005)
  26. Archive-name: aix-faq/part5
  27. Revision: 1.14 2000/01/04 02:34:26
  28. Posting-Frequency: monthly
  29.  
  30. ------------------------------
  31.  
  32. Subject: 6.05  What publications are available for AIX and RS/6000?
  33.  
  34.  
  35.   Publications list:
  36.   http://www.rs6000.ibm.com/resource/aix_resource/Pubs/
  37.  
  38.   AIXpert magazine: http://www.developer.ibm.com/library/aixpert/
  39.  
  40. AIXpert
  41.    IBM Corporation
  42.    Mail Stop 36
  43.    472 Wheelers Farms Road
  44.    Milford, CT 06460
  45.    FAX: (203) 783-7669
  46.  
  47. These manuals should be available from your favorite IBM office.
  48.  
  49. SC23-2204-02  Problem Solving Guide
  50. SC23-2365-01  Performance Monitoring and Tuning Guide for AIX 3.2
  51. SA23-2629-07  Service Request Number Cross Reference, Ver 2.2
  52. SA23-2631-05  Diagnostic Programs: Operator Guide
  53. SA23-2632-05  Diagnostic Programs: Service Guide
  54. SA23-2643-01  Hardware Technical Reference: General Information
  55. SA23-2646-01  Hardware Technical Reference: Options and Devices
  56.  
  57. IBM's International Technical Support Center produces redbooks -
  58. practical, how-to manuals - on a wide range of technical topics
  59. including AIX migration, system management, internet security, and
  60. RS/6000 hardware.  Abstracts and ordering information areavailable
  61. from the redbooks homepage <http://www.redbooks.ibm.com/>.  (See Question
  62. 6.09 also.)
  63.  
  64. Computer bookstores often carry many of the following:
  65.  
  66. "Power RISC System/6000: Concepts, Facilities, Architecture", Chakravarty  
  67.          McGraw-Hill ISBN 0070110476
  68. "PowerPC: Concepts, Facilities, Architecture", Chakravarty/Cannon  
  69.          McGraw-Hill ISBN 0070111928
  70. "The Advanced Programmer's Guide to AIX 3.x", Colledge 
  71.          McGraw-Hill ISBN 007707663X
  72. "AIX Companion" , Cohn    
  73.          Prentice-Hall ISBN 0132912201
  74. "AIX for RS/6000: System & Administration Guide", DeRoest 
  75.          McGraw-Hill ISBN 0070364397
  76. "A Guide to AIX 3.2", Franklin
  77.          Metro-Info Systems 05/1993
  78. "IBM RS6000 AIX System Administration", Hollicker
  79.          Prentice-Hall ISBN 0134526163
  80. "IBM RISC SYSTEM/6000 - A Business Perspective", Hoskins
  81.          John Wiley & Sons ISBN 0471599352
  82. "The Advanced Programmer's Guide to AIX 3.x", Phil Colledge
  83.     McGraw-Hill, 1994, ISBN: 0-07-707663-x
  84. "AIX Performance Tuning", Frank Waters
  85.      Prentice-Hall 1996 ISBN 0-13-386707-2
  86. "The AIX Survival Guide", Andreas Siegert
  87.     Addison-Wesley 1996 ISBN 1-201-59388-2
  88.  
  89. ------------------------------
  90.  
  91. Subject: 6.06: Some acronyms
  92.  
  93. APAR   - Authorized Program Analysis Report
  94.      Created internaly by a systems programmer to solve a code bug.
  95. BOS    - Base Operating System
  96. DCR    - design change request
  97.      Someone asked to change something.
  98. LPP    - Licensed Program Product
  99. ODM    - Object Data Manager
  100.       Don't touch until you grok it.
  101. PRPQ   - programming request for price quotation
  102.      Essentialy, a program that is not available off-the-shelf. 
  103.      (e.g. HACMP started as a PRPQ, you could not order HACMP, but
  104.      you could ask IBM for a highly-available solution)
  105. PTF    - Program Temporary Fix
  106.      Temporary ?  Yes!  Read "The Tao of Computing".
  107. SMIT   - System Management Interface Tool
  108. SMITTY - SMIT, tty interface, no bells, no whistles. "alias smit=smitty"
  109. Y2K    - Done.  Total non-event.
  110.  
  111. ------------------------------
  112.  
  113. Subject: 6.07: How do I get this by mailserver or ftp?
  114.  
  115. Since the articles are crossposted to news.answers, any archive
  116. carrying that newsgroup will also have these articles.  In particular,
  117. try ftp'ing to rtfm.mit.edu and checking the directory
  118. pub/usenet/news.answers. This FAQ is archived as "aix-faq/part[12345]".
  119.  
  120. The FAQ is also availible via email using the address
  121. mail-server@rtfm.MIT.edu two examples of how you might use this from a
  122. UNIX prompt follow:
  123.  
  124. echo help | mail mail-server@rtfm.MIT.edu
  125. echo send usenet/news.answers/aix-faq/part1 | mail mail-server@rtfm.MIT.edu
  126.  
  127. ------------------------------
  128.  
  129. Subject: 6.08: Hypertext version of the FAQ
  130.  
  131. United States:
  132.   <http://www.emerson.emory.edu/services/aix-faq/>
  133.   <http://www.cis.ohio-state.edu/hypertext/faq/usenet/aix-faq/top.html>
  134. New Zealand:
  135.   <http://www.abstract.co.nz/aix-faq/faq.html>
  136. France:
  137.   <http://www-resus.univ-mrs.fr/Us/CS/RS6k/>
  138. Canada:
  139.   <http://auk.uwaterloo.ca/aixgroup/aix-faq>
  140.  
  141. ------------------------------
  142.  
  143. Subject: 6.09: IBM AIX documentation on the WWW.
  144.  
  145. <http://www.ibm.com/servers/aix/library/> contains links to IBM
  146. documentation, this includes links to the redbooks site (how to
  147. documents) as well as links to the AIX 4.3 manuals.
  148.  
  149.  
  150. ------------------------------
  151.  
  152. Subject: 6.10: Comp.unix.aix archive availible on the WWW
  153.  
  154. Michael Staats & Fred Hucht have informed me that a searchable archive of
  155. comp.unix.aix is availible at: 
  156. <http://www.thp.Uni-Duisburg.DE/cuaix/cuaix.html>.
  157.  
  158. ------------------------------
  159.  
  160. Subject: 6.11: How can I access the comp.unix.aix newsgroup
  161.                via email (or Web)?
  162. From: Ciaran Deignan  <C.Deignan@frec.bull.fr>
  163.  
  164. It is possible to get "digests" of the AIX newsgroup by email. Each
  165. digest contains a summary (just the subject lines from each post)
  166. plus the contents of a series of news articles posted to the newsgroup.
  167. Each digest is about 800 lines long, and the newsgroup typically generates
  168. 5 digest mails per day.
  169.  
  170. To get these digests, you have to subscribe to a mailing list. Send
  171. an email to the address majordomo@dmshome.youngstown.oh.us, and put
  172. the text "subscribe aix-digest" in the body of the message.
  173.  
  174. [Editor's note: The above address does not appear to work any longer, if
  175. anyone knows of a functional equivalent please drop me a note.]
  176.  
  177. It is equally possible to post articles to the newsgroup via email.
  178. Any mail sent to the address aixnews@cc.ysu.edu will be forwarded to
  179. the comp.unix.aix newsgroup.
  180.  
  181. These services are provided by Doug Sewell <doug@cc.ysu.edu>.
  182.  
  183. Comp.unix.aix can be accessed from the web via http://www.deja.com/
  184.  
  185. ------------------------------
  186.  
  187.  
  188. Subject: 8.03: How do I set up postscript accounting?
  189.  
  190. [ formerly in section 1.118 ]
  191.  
  192. /*  pswrap.c
  193.  
  194.  compile with:   cc pswrap.c -o pswrap -lqb
  195.  (for doc on the qb library see "understanding backend routines in libqb")
  196.  
  197.  BTW:  The log_charge() function doesn't seem to do anything,
  198.        but log_pages() updates the accounting info.
  199.  
  200. Ephraim Vider, original author 
  201.  
  202. --
  203. Feb 10, 1993
  204.  
  205. You can set pswrap up to use either the accounting file specified in
  206. /etc/qconfig (which means that you need to get your data from 'pac') or
  207. you can comment out the #define WANT_PAC line and then the accounting
  208. data will only go into the ACCTFILE.
  209.  
  210. Also modified the logging to the ASCII acctfile so that it looks more
  211. readable.
  212.  
  213. Vince Taluskie
  214. */
  215.  
  216.  #include <stdio.h>
  217.  #include <string.h>
  218.  #include <ctype.h>
  219.  #include <fcntl.h>
  220.  #include <signal.h>
  221.  #include <setjmp.h>
  222.  #include <sys/wait.h>
  223.  #include <IN/backend.h>
  224.  #include <IN/standard.h>
  225.  #include "qprocs.h"
  226.  
  227.  char     *nextword (char *p);
  228.  char     *skipvalue (char *p);
  229.  
  230.  #define LOGDIR     "/tmp"
  231.  #define ACCTFILE   "/usr/adm/acct/lpr/ps-acct"
  232. /* #define WANT_PAC     1 */     /* this define will also send accounting
  233.                                  info to the acctfile specified in
  234.                  /etc/qconfig file.  If this define is 
  235.                  commented out then accounting info will
  236.                  only go to ACCTFILE  */
  237.  
  238.  
  239.  char     pcprog[] = "statusdict begin pagecount = end\n\x04";
  240.  
  241.  char     *keyw[] = {
  242.      "idle",
  243.      "busy",
  244.      "waiting",
  245.      "printing",
  246.      "initializing",
  247.      NULL
  248.  };
  249.  enum     { PS_IDLE, PS_BUSY, PS_WAIT, PS_PRINT, PS_INIT, PS_UNKNOWN };
  250.  
  251.  void     giveup();
  252.  jmp_buf  jumper;
  253.  
  254.  char     logfname[30];
  255.  FILE     *logfile, *acctfile;
  256.  
  257.  main (argc, argv)
  258.  int argc;
  259.  char     *argv[];
  260.  {
  261.      char *devname;
  262.      int  pagcnt, c;
  263.      int  pid;
  264.      int  w, status;
  265.  
  266.      if (argc < 2) {
  267.           fprintf(stderr, "Usage: psbe file\n");
  268.           exit(-1);
  269.      }
  270.      if (log_init(argv[1]) < 0) {
  271.           fprintf(stderr, "log_init failed!\n");
  272.           exit(EXITBAD);
  273.      }
  274.      sprintf(logfname, "%s/%s.log", LOGDIR, get_device_name());
  275.      if ((logfile = fopen(logfname, "a")) == NULL) {
  276.           fprintf(stderr, "Can't open logfile.\n");
  277.           exit(EXITBAD);
  278.      }
  279.  
  280.      if ((acctfile = fopen(ACCTFILE, "a")) == NULL) {
  281.      fprintf(stderr, "Can't open logfile.\n");
  282.      exit(EXITBAD);
  283.      }
  284.  
  285.      setvbuf(logfile, NULL, _IOLBF, BUFSIZ);
  286.      setvbuf(acctfile, NULL, _IOLBF, BUFSIZ);
  287.  
  288.      setvbuf(stdin, NULL, _IONBF, 0);
  289.      setvbuf(stdout, NULL, _IONBF, 0);
  290.      fprintf(logfile, "start Job no. %d, queued on %s\n", get_job_number(),
  291.                get_qdate());
  292.      log_status(WAITING);
  293.      pagcnt = getpagecnt();
  294.      log_status(RUNNING);
  295.      if ((pid = fork()) < 0) {
  296.           perror("fork");
  297.           exit(EXITBAD);
  298.      }
  299.      if (pid == 0) {
  300.           argv[0] = "piobe";
  301.           execv("/usr/lpd/piobe", argv);
  302.           perror("exec");
  303.           exit(EXITBAD);
  304.      }
  305.      while ((w = wait(&status)) != pid)
  306.           if (w == -1) {
  307.                perror("wait");
  308.                exit(EXITBAD);
  309.           }
  310.      if (WEXITSTATUS(status) != 0)
  311.           exit(WEXITSTATUS(status));
  312.      log_status(WAITING);
  313.  
  314.      if (pagcnt > 0 && (c = getpagecnt()) > 0) {
  315. #ifdef WANT_PAC 
  316.           log_pages(c - pagcnt);
  317. #endif
  318.     }
  319.  
  320.      fprintf(logfile, "end Job no. %d, queued on %s\n", get_job_number(),
  321.                get_qdate());
  322.  
  323. /* the accounting file format is 
  324.  
  325. pages_printed     user     queue_printed_on   time_queued
  326.  
  327. */
  328.  
  329.      fprintf(acctfile, "%d %35s %7s    %s \n", (c - pagcnt), get_from(), get_queue_name(), get_qdate());
  330.  
  331.      fclose(logfile);
  332.      fclose(acctfile);
  333.      exit(EXITOK);
  334.  }
  335.  
  336.  void     giveup ()
  337.  {
  338.      longjmp(jumper, 1);
  339.  }
  340.  
  341.  getpagecnt ()
  342.  {
  343.      int  pc = 0, pstat;
  344.      char buf[81];
  345.  
  346.      if (setjmp(jumper) != 0) {
  347.           fprintf(logfile, "giving up on status\n");
  348.           return (0);
  349.      }
  350.      alarm(60 * 2);
  351.      signal(SIGALRM, giveup);
  352.      do {
  353.           if (!gets(buf)) {
  354.                sleep(5);
  355.                putchar('\x14');    /* ^T returns status */
  356.                sleep(1); /* wait for answer from printer */
  357.                if (!gets(buf))
  358.                     return (0);
  359.           }
  360.           fprintf(logfile, "%s\n", buf);
  361.           if ((pstat = getstatus(buf)) == PS_WAIT) {
  362.                putchar('\x04');
  363.                sleep(1);
  364.           }
  365.      } while (pstat != PS_IDLE);
  366.      alarm(0);
  367.      while (gets(buf))
  368.           fprintf(logfile, "%s\n", buf);
  369.      printf("%s", pcprog);
  370.      sleep(1); /* wait for answer from printer */
  371.      if (!gets(buf))
  372.           return (0);
  373.      if (sscanf(buf, "%d", &pc) != 1)
  374.           return (0);
  375.      fprintf(logfile, "%d\n", pc);
  376.      return (pc);
  377.  }
  378.  
  379.  /*
  380.   * Parser for printer status messages
  381.   */
  382.  
  383.  getstatus (p)
  384.  char     *p;
  385.  {
  386.      char *t;
  387.      int  i;
  388.  
  389.      if ((p = strchr(p, '%')) == NULL)
  390.           return (PS_UNKNOWN);
  391.      if (strncmp(p, "%%[", 3) != 0)
  392.           return (PS_UNKNOWN);
  393.      for (p = nextword(p + 3) ; p != NULL ; p = skipvalue(p)) {
  394.           t = p;
  395.           p = strchr(p, ':');
  396.           *p++ = '\0';
  397.           p = nextword(p);
  398.           if (strcmp(t, "status") == 0)
  399.                break;
  400.      }
  401.      if (p == NULL)
  402.           return (PS_UNKNOWN);
  403.      t = p;
  404.      p = strchr(p, ' ');
  405.      if (p[-1] == ';')
  406.           p--;
  407.      *p = '\0';
  408.      for (i = 0 ; keyw[i] != NULL ; i++)
  409.           if (strcmp(t, keyw[i]) == 0)
  410.                break;
  411.      return (i);
  412.  }
  413.  
  414.  char     *nextword (p)
  415.  char     *p;
  416.  {
  417.      while (isspace(*p))
  418.           p++;
  419.      if (strncmp(p, "]%%", 3) == 0)
  420.           return (NULL);
  421.      return (p);
  422.  }
  423.  
  424.  char     *skipvalue (p)
  425.  char     *p;
  426.  {
  427.      char *t;
  428.  
  429.      while (p != NULL) {
  430.           p = strchr(p, ' ');
  431.           t = p;
  432.           p = nextword(p);
  433.           if (t[-1] == ';')
  434.                break;
  435.      }
  436.      return (p);
  437.  }
  438.  
  439.  /*********    qprocs.h    ***********/
  440.  /* functions for communication between qdaemon and the backend */
  441.  
  442.  char     *get_from();
  443.  char     *get_to();
  444.  char     *get_qdate();
  445.  char     *get_queue_name();
  446.  char     *get_device_name();
  447.  char     *get_title();
  448.  
  449.  
  450. ------------------------------
  451.  
  452. Subject: 8.04: How can I find out the machine type?
  453. From: anonymous
  454.  
  455. [ formerly in section 1.126 ]
  456.  
  457. #!/bin/ksh
  458. # Determine machine type
  459. # Jim O'Quinn  2/28/93
  460. # AIX Software Support
  461. # This does not represent my employer, use at own risk.....
  462. # Changed to report newer machines and unknown ids. /Fred
  463. # More new machines. /David
  464.  
  465. MachType=`uname -m | cut -c9-10`
  466. case $MachType
  467. in
  468.   02)  nMachType="7015/930";;
  469.   10)  nMachType="7013/530 or 7016/720 or 7016/730";;
  470.   11|14)  nMachType="7013/540";;
  471.   18)  nMachType="7013/53H";;
  472.   1C)  nMachType="7013/550";;
  473.   20)  nMachType="7015/930";;
  474.   2E)  nMachType="7015/950 or 7015/950E";;
  475.   30)  nMachType="7013/520 or 7018/740 or 7018/741";;
  476.   31)  nMachType="7012/320";;
  477.   34)  nMachType="7013/52H";;
  478.   35)  nMachType="7012/32H or 7012/320E";;
  479.   37)  nMachType="7012/340 or 7012/34H";;
  480.   38)  nMachType="7012/350";;
  481.   41)  nMachType="7011/220 or 7011/22W or 7011/22G or 7011/230";;
  482.   42)  nMachType="7006/41T or 7006/41W";;
  483.   43)  nMachType="7008/M20";;
  484.   45)  nMachType="7011/220 or 7011/M20 or 7011/230 or 7011/23W";;
  485.   46)  nMachType="7011/250";;
  486.   47)  nMachType="7011/230";;
  487.   48)  nMachType="7009/C10";;
  488.   49)  nMachType="7011/250";;
  489.   4C)  nMachType="604/43P";;
  490.   4D)  nMachType="601/40P";;
  491.   57)  nMachType="7012/390 or 7012/3BT or 7030/3BT or 7032/3AT or 7011/390";;
  492.   58)  nMachType="7012/380 or 7012/3AT or 7030/3BT";;
  493.   59)  nMachType="3CT or 39H";;
  494.   5C)  nMachType="7013/560";;
  495.   63)  nMachType="7015/970 or 7015/97B";;
  496.   64)  nMachType="7015/980 or 7015/98B";;
  497.   66)  nMachType="7013/580 or 7013/58F or 7015/580";;
  498.   67)  nMachType="7013/570 or 7013/770 or 7013/771 or 7013/R10 or 7015/570";;
  499.   70)  nMachType="7013/590";;
  500.   71)  nMachType="7013/58H";;
  501.   72)  nMachType="7013/59H or 7013/R12 or 7013/58H";;
  502.   75)  nMachType="7012/370 or 7012/375 or 7012/37T";;
  503.   76)  nMachType="7012/360 or 7012/365 or 7012/36T";;
  504.   77)  nMachType="7012/315 or 7012/350 or 7012/355 or 7012/510 or 7012/55H or 7012/55L";;
  505.   78)  nMachType="7012/315 or 7013/510";;
  506.   79)  nMachType="7013/590";;
  507.   80)  nMachType="7015/990";;
  508.   82)  nMachType="7015/R00 or 7015/R24";;
  509.   90)  nMachType="IBM C20";;
  510.   91)  nMachType="604/42T";;
  511.   A0)  nMachType="7013/J30 or 7013/R30";;
  512.   A3)  nMachType="7013/R30";;
  513.   A6)  nMachType="7012/G30";;
  514.   C4)  nMachType="F40";;
  515.   E0)  nMachType="603/MOTOROLA PowerStack";;
  516.   *)  nMachType="Unknown($MachType)"
  517. esac
  518. echo "Machine type: "$nMachType"
  519.  
  520. From: Jan Just Keijser <KeijserJJ@logica.com> 
  521.  
  522. I've attached a C program which determines the model and the amount of
  523. memory installed in C code (by querying the ODM directly). It can be
  524. compiled using
  525.   cc -o model model.c -lcfg -lodm
  526.  
  527. #include <stdio.h>
  528. #include <sys/utsname.h>
  529. #include <unistd.h>
  530.  
  531. #include <string.h>
  532. #include <cf.h>
  533. #include <sys/cfgodm.h>
  534. #include <sys/cfgdb.h>
  535.  
  536. void main (void)
  537. {
  538.   struct utsname    name;
  539.   int            memsize;
  540.  
  541.   char         s[3];
  542.   int          model;
  543.  
  544.   struct CuAt *odm_obj;
  545.   int          how_many;
  546.  
  547.   uname(&name);
  548.  
  549.   printf( "sysname  = %s\n", name.sysname );
  550.   printf( "nodename = %s\n", name.nodename );
  551.   printf( "release  = %s\n", name.release );
  552.   printf( "version  = %s\n", name.version );
  553.   printf( "machine  = %s\n", name.machine );
  554.  
  555.   printf( "model    = " );
  556.    /* On AIX, the model is encoded in the last 2 non-zero digits
  557.       of the model code (uname -m)
  558.    */
  559.    s[0] = name.machine[ strlen( name.machine ) - 4 ];
  560.    s[1] = name.machine[ strlen( name.machine ) - 3 ];
  561.    s[2] = '\0';
  562.    model = strtol(s, NULL, 16);
  563.   
  564.    switch (model)
  565.    {
  566.       case 0x10:  puts ( "Model 530/730" );
  567.                   break;
  568.       case 0x11:
  569.       case 0x14:  puts ( "Model 540" );
  570.                   break;
  571.       case 0x18:  puts ( "Model 530H" );
  572.                   break;
  573.       case 0x1C:  puts ( "Model 550" );
  574.                   break;
  575.       case 0x20:  puts ( "Model 930" );
  576.                   break;
  577.       case 0x2E:  puts ( "Model 950/950E" );
  578.                   break;
  579.       case 0x30:  puts ( "Model 520 or 740/741" );
  580.                   break;
  581.       case 0x31:  puts ( "Model 320" );
  582.                   break;
  583.       case 0x34:  puts ( "Model 520H" );
  584.                   break;
  585.       case 0x35:  puts ( "Model 32H/320E" );
  586.                   break;
  587.       case 0x37:  puts ( "Model 340/34H" );
  588.                   break;
  589.       case 0x38:  puts ( "Model 350" );
  590.                   break;
  591.       case 0x41:  puts ( "Model 220/22W/22G/230" );
  592.                   break;
  593.       case 0x42:  puts ( "Model 41T/41W" );
  594.                   break;
  595.       case 0x43:  puts ( "Model M20" );
  596.                   break;
  597.       case 0x45:  puts ( "Model 220/M20/230/23W" );
  598.                   break;
  599.       case 0x46:
  600.       case 0x49:  puts ( "Model 250" );
  601.                   break;
  602.       case 0x47:  puts ( "Model 230" );
  603.                   break;
  604.       case 0x48:  puts ( "Model C10" );
  605.                   break;
  606.       case 0x4C:  puts ( "PowerPC 603/604 model" );
  607.                   break;
  608.       case 0x4D:  puts ( "Model 40P" );
  609.                   break;
  610.       case 0x57:  puts ( "Model 390/3AT/3BT" );
  611.                   break;
  612.       case 0x58:  puts ( "Model 380/3AT/3BT" );
  613.                   break;
  614.       case 0x59:  puts ( "Model 39H/3CT" );
  615.                   break;
  616.       case 0x5C:  puts ( "Model 560" );
  617.                   break;
  618.       case 0x63:  puts ( "Model 970/97B" );
  619.                   break;
  620.       case 0x64:  puts ( "Model 980/98B" );
  621.                   break;
  622.       case 0x66:  puts ( "Model 580/58F" );
  623.                   break;
  624.       case 0x67:  puts ( "Model 570/770/R10" );
  625.                   break;
  626.       case 0x70:  puts ( "Model 590" );
  627.                   break;
  628.       case 0x71:  puts ( "Model 58H" );
  629.                   break;
  630.       case 0x72:  puts ( "Model 59H/58H/R12/R20" );
  631.                   break;
  632.       case 0x75:  puts ( "Model 370/375/37T" );
  633.                   break;
  634.       case 0x76:  puts ( "Model 360/365/36T" );
  635.                   break;
  636.       case 0x77:  puts ( "Model 315/350/355/510/550H/550L" );
  637.                   break;
  638.       case 0x79:  puts ( "Model 591" );
  639.                   break;
  640.       case 0x80:  puts ( "Model 990" );
  641.                   break;
  642.       case 0x81:  puts ( "Model R24" );
  643.                   break;
  644.       case 0x82:  puts ( "Model R00/R24" );
  645.                   break;
  646.       case 0x89:  puts ( "Model 595" );
  647.                   break;
  648.       case 0x90:  puts ( "Model C20" );
  649.                   break;
  650.       case 0x91:  puts ( "Model 42T" );
  651.                   break;
  652.       case 0x94:  puts ( "Model 397" );
  653.                   break;
  654.       case 0xA0:  puts ( "Model J30" );
  655.                   break;
  656.       case 0xA1:  puts ( "Model J40" );
  657.                   break;
  658.       case 0xA3:  puts ( "Model R30" );
  659.                   break;
  660.       case 0xA4:  puts ( "Model R40" );
  661.                   break;
  662.       case 0xA6:  puts ( "Model G30" );
  663.                   break;
  664.       case 0xA7:  puts ( "Model G40" );
  665.                   break;
  666.       case 0xC4:  puts ( "Model F30" );
  667.                   break;
  668.       default:    printf( "Model code: %s\n", s );
  669.                   break;
  670.    }
  671.  
  672. /* Get the amount of installed memory */
  673.   odm_set_path("/etc/objrepos");
  674.   /* Get a single ODM object */
  675.   odm_obj = getattr("sys0", "realmem", 0, &how_many);
  676.   memsize = atoi(odm_obj->value) / 1024;
  677.   odm_terminate();
  678.   printf( "Memory   = %d MB\n", memsize );
  679.  
  680. /* Print the number of processors */
  681.   printf("#processor configured = %d\n", sysconf(_SC_NPROCESSORS_CONF));
  682.   printf("#processor online     = %d\n", sysconf(_SC_NPROCESSORS_ONLN));
  683.  
  684. }
  685.  
  686. ------------------------------
  687.  
  688. Subject: 8.05: Updating to 3.2.5
  689.  
  690. [ formerly in section 1.127 ]
  691.  
  692. =-=-=-=-=-=-=-= cut here =-=-=-=-=-=-=-=-=-=-=
  693. #!/bin/ksh
  694. # @(#) mktape2disk.sh  creates files from tape on disk.
  695.  
  696. # change name prefix here
  697. NAME="f"
  698.  
  699. # from file #i to file #j
  700. integer i=1
  701. integer j
  702.  
  703. # test arguments
  704. if [ -z "${1}" ]
  705. then
  706.   echo "\nusage: $(basename ${0}) <drive_no> <#files>\n"
  707.   echo "\t<drive_no>: tape drive number (e.g. 0)"
  708.   echo "\t<#files>  : number of files to copy from the tape\n"
  709.   exit 1
  710. fi
  711. device=/dev/rmt${1}.1
  712.  
  713. # test arguments
  714. if [ -z "${2}" ]
  715. then
  716.   echo "\nusage: $(basename ${0}) <drive_no> <#files>\n"
  717.   echo "\t<drive_no>: tape drive number (e.g. 0)"
  718.   echo "\t<#files>  : number of files to copy from the tape\n"
  719.   exit 1
  720. fi
  721. j=${2}
  722.  
  723. tctl -f ${device} rewind
  724. if [ $? -ne 0 ]
  725. then
  726.   exit 1
  727. fi
  728.  
  729. # create tape
  730. while [ ${i} -le ${j} ]
  731. do
  732.     echo "Copy file #${i} of #${j} from (${device}) to disk as (${NAME}${i})."
  733.     dd if=${device} of="${NAME}${i}" bs=200k
  734.     i=i+1
  735. done
  736. tctl -f ${device} rewind
  737. exit 0
  738. =-=-=-=-=-=-=-= cut here =-=-=-=-=-=-=-=-=-=-=
  739.  
  740. 5) Create a new .toc file
  741.  
  742.    # cd /pub/pmp3250
  743.    # inutoc .
  744.    # pg .toc
  745.  
  746. 6) Place the following file named 'runme.sh' in the PMP directory
  747.  
  748. =-=-=-=-=-=-=-= cut here =-=-=-=-=-=-=-=-=-=-=
  749. #!/bin/ksh
  750. # @(#) runme.sh for PMP3250
  751. #
  752. INSTP="/usr/sbin/installp"
  753. LOG="/tmp/installp.log"
  754. TEE="/usr/bin/tee"
  755. PATCHDIR=$(pwd)
  756. #
  757. /usr/bin/cp /usr/lpp/info/data/ispaths /usr/lpp/info/data/ispaths.save
  758. #
  759. INFODIR="/usr/lpp/info/$LANG/aixmin"
  760. /usr/bin/mkdir ${INFODIR} 2>/dev/null >/dev/null
  761. if [ ! -w ${INFODIR} ]
  762. then
  763.     print "\n\t*ERROR* Can not (write) access [${INFODIR}]."
  764.     print "\tPlease unmount CD or NFS filesystems.\n"
  765.     exit -1
  766. fi
  767. #
  768. # Commit all ptf's
  769. #
  770. ${INSTP} -Xc all 2>&1 | ${TEE} ${LOG}.0
  771. #
  772. # Install latest installp patch
  773. #
  774. ${INSTP} -BXacgq -d ${PATCHDIR} bos.obj 3.2.0.0.U422463 2>&1 | ${TEE} ${LOG}.1
  775. #
  776. # Install latest installp patch
  777. #
  778. ${INSTP} -BXacgq -d ${PATCHDIR} bos.obj 3.2.0.0.U422467 2>&1 | ${TEE} ${LOG}.6
  779. #
  780. # Run the ptfdir clean utility.
  781. #
  782. /usr/sbin/ptfdir_clean -y -f -v 2>&1 | ${TEE} ${LOG}.2
  783. #
  784. # Install the PMP.    Version 1
  785. #
  786. /usr/lib/instl/sm_inst installp_cmd   \
  787.         -T m -q -a -g -B              \
  788.         -d ${PATCHDIR}                \
  789.         -S '3250 AIX Maintenance Level U493250' \
  790.         -c  -N  -X                    \
  791.         2>&1 | ${TEE} ${LOG}.3
  792. #
  793. # Install the PMP.    Version 2
  794. #
  795. # /usr/sbin/update_all
  796. #
  797. # Install latest installp patch
  798. #
  799. /usr/bin/lppchk -v | ${TEE} ${LOG}.4
  800. #
  801. # Show level of installp patch
  802. #
  803. /usr/bin/lslpp -m bos.obj | ${TEE} ${LOG}.5
  804. #
  805. # Guess you should reboot now.
  806. #
  807. sync;sync
  808. print - "\n\n\tDone......guess you should reboot now !!\n"
  809. exit 0
  810. =-=-=-=-=-=-=-= cut here =-=-=-=-=-=-=-=-=-=-=
  811.  
  812. 7) To run the update on your server
  813.  
  814.    ===>> Please read the Installation Instructions first <<==
  815.  
  816.    # cd /pub/pmp3250
  817.    # ./runme.sh
  818.  
  819.                    ........WAIT...........
  820.  
  821.    # /etc/shutdown -Fr
  822.  
  823. 8) NFS export the PMP dir as READ-ONLY to all your clients.
  824.  
  825. 9) To update a client system
  826.  
  827.     a -  Mount the PMP filesystem from the server
  828.     b -  cd <mounted_filesystem>
  829.     c -  execute ./runme.sh
  830.     d -  Unmount PMP filesystem
  831.     e -  reboot
  832.  
  833. 10) To create a copy 1:1 of the tape you received use the script 'mktape.sh'
  834.  
  835.    # cd /pub/pmp3250
  836.    # mktape.sh 0
  837.  
  838. =-=-=-=-=-=-=-= cut here =-=-=-=-=-=-=-=-=-=-=
  839. #!/bin/ksh
  840. # @(#) mktape.sh: creates a bootable tape from images on disk
  841.  
  842. # change name prefix here
  843. NAME="f"
  844.  
  845. # usage: mktape drive_no
  846. #        drive_no = tape drive number
  847. # test arguments
  848. if [ -z "${1}" ]
  849. then
  850.   echo "\nusage: mktape <drive_no>"
  851.   echo "         <drive_no>: tape drive number (e.g. 0)\n"
  852.   exit 1
  853. fi
  854. device=/dev/rmt${1}.1
  855.  
  856. tctl -f ${device} rewind
  857. if [ $? -ne 0 ]
  858. then
  859.   exit 1
  860. fi
  861.  
  862. # create tape
  863. i=1
  864. while test -r "${NAME}${i}"
  865. do
  866.     echo "copy ${i}"
  867.     if [ $i -le 3 ]
  868.     then
  869.       dd if="${NAME}${i}" of=${device} conv=sync bs=1k
  870.     else
  871.       dd if="${NAME}${i}" of=${device} bs=200k
  872.     fi
  873.     let i=${i}+1
  874. done
  875. tctl -f ${device} rewind
  876. exit 0
  877.  
  878. ------------------------------
  879.  
  880. Subject: 8.06: How do I do remote backup?
  881. From: kraemerf@franvm3.VNET.IBM.COM (Frank Kraemer)
  882.  
  883. [ formerly in section 1.201 ]
  884.  
  885. #!/bin/ksh
  886. # @(#) Create a backup tape of the private user data.
  887. #=================================================================#
  888. #   Script :  usave.sh                                            #
  889. #   Author :  F. Kraemer                                          #
  890. #   Date   :  92/02/19                                            #
  891. #   Update :  92/10/29                                            #
  892. #   Info   :  the ultimative backup script                        #
  893. #   Example:  usave.sh /dev/rmt0      -  save to local tape       #
  894. #             usave.sh /save/save.me  -  save to local file       #
  895. #             usave.sh /tmp/pipe      -  save to remote tape      #
  896. #-----------------------------------------------------------------#
  897. PS4="(+) "
  898. #set -x
  899. PROG=$(basename $0)
  900. HOST=$(hostname)
  901. TODAY=$(date +%H:%M:%S)
  902. #
  903. # cleanup
  904. #
  905. cleanup ()
  906. {
  907. ec=$1
  908. error=$2
  909. case "$ec"
  910. in
  911.    "$USAGE_EC")    # usage error
  912.      error="Usage:\t$PROG DeviceName\n" 1>&2
  913.     ;;
  914.    "$NOTAP_EC")    # Tape error
  915.      error="error:\t$PROG: $DEVICE is not available on the system.\n" 1>&2
  916.     ;;
  917.    "$LISTE_EC")    # list error
  918.      error="error:\t$PROG: could not create tar list for $LOGNAME.\n" 1>&2
  919.     ;;
  920.    "$NOTAR_EC")    # tar command error
  921.      error="error:\t$PROG: tar command failed.\n" 1>&2
  922.     ;;
  923.    "$PIPEP_EC")    # pipe error
  924.      error="error:\t$PROG: mknod command failed.\n" 1>&2
  925.     ;;
  926.    "$NORSH_EC")    # rsh error
  927.      error="error:\t$PROG: rsh - Remote Shell command failed.\n" 1>&2
  928.     ;;
  929.    "$RHOST_EC")    # remote host error
  930.      error="error:\t$PROG: Remote Host unknown.\n" 1>&2
  931.     ;;
  932.    *)
  933.    ;;
  934. esac
  935. case "$DEVICE"
  936. in
  937.     #
  938.     # Fix the block size if $DEVICE is a tape device
  939.     #
  940.     /dev/rmt[0-9]*)
  941.         echo "\n\t$PROG: Rewinding tape to begin.........(please wait)\n"
  942.         tctl -f $DEVICE rewind 2>/dev/null
  943.         ;;
  944.     *) ;;
  945. esac
  946. rm -f ${LIST} ${PIPE} 2>/dev/null
  947. [ -n "$error" ] && echo "\n${error}\n"
  948. trap '' 0 1 2 15
  949. exit "$ec"
  950. }
  951. #
  952. # Variables
  953. #
  954. USAGE_EC=1                         # exit code for usage error
  955. NOMNT_EC=2                         # exit code wrong device name
  956. NOTAP_EC=3                         # exit code no tape available
  957. LISTE_EC=4                         # exit code backup list error
  958. NOTAR_EC=5                         # exit code for wrong tar
  959. TRAPP_EC=6                         # exit code for trap
  960. PIPEP_EC=7                         # exit code for pipe
  961. RHOST_EC=8                         # exit code for bad ping
  962. NORSH_EC=9                         # exit code for bad rsh
  963. DEVICE="$1"                        # device to tar into
  964. LIST="/tmp/.tar.$LOGNAME.$$"       #
  965. REMOTEH=""                         # Remote host for backup
  966. REMOTET=""                         # Remote tape for backup
  967. tapedev=                           #
  968. PIPE="/tmp/pipe"                   # Pipe for remote backup
  969. #
  970. # main()
  971. #
  972. tput clear
  973. echo "\n\t$PROG started from $LOGNAME@$HOST on $TERM at $TODAY.\n"
  974. rm -f $LIST 2>/dev/null
  975. #
  976. # Trap on exit/interrupt/break to clean up
  977. #
  978. trap "cleanup $TRAPP_EC \"Abnormal program termination. $PROG"\"  0 1 2 15
  979. #
  980. # Check command options
  981. #
  982. [ "$#" -ne 1 ]  &&  cleanup "$USAGE_EC" ""
  983. #
  984. # Check device name
  985. #
  986. [ `expr "$DEVICE" : "[/]"` -eq 0 ] && cleanup "$NOMNT_EC" \
  987.         "$PROG: Backup device or file name must start with a '/'."
  988. #
  989. # Check tape device
  990. #
  991. case "$DEVICE"
  992. in
  993.     #
  994.     # Fix the block size if $DEVICE is a tape device
  995.     #
  996.     /dev/rmt[0-9]*)
  997.         #
  998.         echo "\n\t$PROG: Verify backup media ($DEVICE)............\n"
  999.         #
  1000.         # see if a low or high density tape device was specified
  1001.         # (eg rmt0.1)
  1002.         density="`expr $DEVICE : \
  1003.                 "/dev/rmt[0-9]*\.\([0-9]*\)"`"
  1004.         #
  1005.         # strip /dev/ from device name and
  1006.         # get the base name (eg translate:
  1007.         # /dev/rmt0.2 to rmt0)
  1008.         #
  1009.         tapedev="`expr $DEVICE : \
  1010.                 "/dev/\(rmt[0-9]*\)[\.]*[0-9]*"`"
  1011.         #
  1012.         # Check if the tape is defined in the system.
  1013.         lsdev -C -c tape -S Available -F "name" | grep $tapedev >/dev/null 2>&1
  1014.         rc=$?
  1015.         [ "$rc" -ne 0 ] && cleanup "$NOTAP_EC" ""
  1016.         #
  1017.         # Restore old tape name.
  1018.         #
  1019.         [ "${density:-1}" -lt 4 ] && density=1 || density=5
  1020.         DEVICE="/dev/${tapedev}.${density}"
  1021.         echo "\n\t$PROG: Insert a tape in ($DEVICE)........(press enter)\n"
  1022.         read TEMP
  1023.         echo "\n\t$PROG: Rewinding tape to begin...........(please wait)\n"
  1024.         tctl -f $DEVICE rewind 2>/dev/null
  1025.         ;;
  1026.     #
  1027.     # Backup is done on remote host. The remote shell facility
  1028.     # must be set up and running.
  1029.     #
  1030.     ${PIPE}*)
  1031.         #
  1032.         echo "\n\t$PROG: Assuming remote backup via network.\n"
  1033.         echo "\t$PROG: Enter name of Remote Host   ===> \c"
  1034.         read REMOTEH
  1035.         echo "\n\t$PROG: Pinging Remote Host to test connection.\n"
  1036.         ping ${REMOTEH} 1 1 >/dev/null 2>&1
  1037.         rc=$?                                    # give up unknown host
  1038.         [ "$rc" -ne 0 ] && cleanup "$RHOST_EC" ""
  1039.         JUNK=$(rsh ${REMOTEH} "/usr/sbin/lsdev -C -c tape -S Available")
  1040.         rc=$?                                    # give up rsh failed
  1041.         [ "$rc" -ne 0 ] && cleanup "$NORSH_EC" ""
  1042.         echo "\t$PROG: Available Tapes on ${REMOTEH} are :\n\n\t\t${JUNK}\n"
  1043.         echo "\t$PROG: Enter name of Remote Tape (e.g. /dev/rmt0) ===> \c"
  1044.         read REMOTET
  1045.         echo "\n\t$PROG: Insert tape on ${REMOTEH} in ${REMOTET}..(press enter)"
  1046.         read TEMP
  1047.         echo "\t$PROG: Rewinding Remote Tape ${REMOTET} on ${REMOTEH}.\n"
  1048.         rsh ${REMOTEH} "tctl -f ${REMOTET} rewind"
  1049.         rc=$?                                    # give up rsh failed
  1050.         [ "$rc" -ne 0 ] && cleanup "$NOTAP_EC" ""
  1051.         rm -f ${PIPE} 2>/dev/null
  1052.         mknod ${PIPE} p
  1053.         rc=$?                                    # give up mknod failed
  1054.         [ "$rc" -ne 0 ] && cleanup "$PIPEP_EC" ""
  1055.         cat ${DEVICE} | rsh ${REMOTEH} "dd of=${REMOTET} obs=100b 2>/dev/null" &
  1056.         ;;
  1057.     *)  ;;
  1058. esac
  1059. #
  1060. # Prepare the list
  1061. #
  1062. echo "\n\t$PROG: Create list of files to be saved...."
  1063. find $HOME -print > $LIST
  1064. rc=$?
  1065. [ "$rc" -ne 0 ] &&  cleanup "$LISTE_EC" ""
  1066. #
  1067. # tar the files
  1068. #
  1069. echo "\n\t$PROG: Changing current directory to (/)...."
  1070. cd / > /dev/null 2>&1
  1071. echo "\n\t$PROG: Running tar format backup from user ($LOGNAME)...."
  1072. tar -cvf "$DEVICE" -L "$LIST"
  1073. rc="$?"
  1074. [ "$rc" -ne 0 ]  && cleanup "$NOTAR_EC" ""
  1075. #
  1076. # Backup completed
  1077. #
  1078. TODAY=$(date +%H:%M:%S)
  1079. echo "\n\t$PROG ended at $TODAY............................\n\n"
  1080. cleanup 0
  1081.  
  1082. ------------------------------
  1083.  
  1084. Subject: 8.06: How do I do remote backup? (cont.)
  1085. From: Henk van Doorn <hvdoorn@xs4all.nl>
  1086.  
  1087. #!/bin/ksh
  1088. #######################################################################
  1089. #     rmksysb                                                         #
  1090. #######################################################################
  1091. #                                                                     #
  1092. # Description:                                                        #
  1093. #       creates a bootable mksysb backup of a remote system running   #
  1094. #    AIX 3.x or lists the Table of Contents of the current tape    #
  1095. #                                                                     #
  1096. # Usage:                                                              #
  1097. #       ./rmksysb $1 [$2]                           #
  1098. #        $1 - remote host to be backed up              #
  1099. #        $2 - optional: local tape device (default: rmt0)      #
  1100. #    or:                                  #    
  1101. #    ./rmksysb -l [$2]                                             #
  1102. #        to list Table of Contents saveset on tape in $2          #
  1103. #        (only useful on tapes created by rmksysb)          #
  1104. #                                                                     #
  1105. # Output:                                                             #
  1106. #       a bootable mksysb of the remote system                        #
  1107. #    or a listing of the TOC saveset on the current tape          #
  1108. #                                                                     #
  1109. # Remarks:                                  #
  1110. #    . rmksysb can only be used by root                  #    
  1111. #    . this script will use tapedevice .1, so if                 #
  1112. #      a >2.3GB drive is used: check density_set_1                  #
  1113. #    . the remote host needs /.rhosts to include the local host    #
  1114. #      for root access (+ shell enabled in /etc/inetd.conf)        #    
  1115. #    . you will need some room (>1.5MB) on /tmp on the remote host #
  1116. #      for standard mksysb .archive.list.* etc.              #
  1117. #    . remote standard output & standard error (except dd/chdev)   #
  1118. #      will go to local stdout & stderr                  #
  1119. #    . redirecting stdout can create quite large log-files (2MB)   #
  1120. #    . AIX versions should not be too far apart as the boot-saveset#
  1121. #      comes from the local system & the rest from the remote      #
  1122. #      (tested on AIX 3.2.5, AIX 4+ definitely won't work!!!)      #
  1123. #    . most likely this script will fail with multi-tape mksysb's: #
  1124. #      another incentive to keep rootvg as small as possible!      #
  1125. #                                      #
  1126. # Author:                                  #
  1127. #    Henk van Doorn                              #
  1128. #    Email: hvdoorn@xs4all.nl                             #
  1129. #                                      #
  1130. #    Thanks to all who contributed. Esp. Paul Wynn (AIXpert '93),  #
  1131. #    my colleagues Dominic Dinardo & Douwe van Terwisga          #
  1132. #    + the input from Usenet were stimulating; thanks folks!          #
  1133. #    I would welcome any additions & changes for the better...     # 
  1134. #                                                                     #
  1135. #######################################################################
  1136. #         CHANGES                                                     #
  1137. #######################################################################
  1138. #                                                                     #
  1139. # ID     WHO   DATE                        DESCR                      #
  1140. # --     ---   -------  --------------------------------------------- #
  1141. # X000     HvD   6Jan95   Created this file.                            #
  1142. # X001     HvD   2Feb95   Final version                                 #
  1143. #######################################################################
  1144.  
  1145. set +u
  1146.  
  1147. # Global variable definitions.
  1148. UMASK=`umask`
  1149. BLK_SZ=1024
  1150. BOOT_BLK_SZ=512
  1151. HOST=${1}
  1152.  
  1153. # TAPE = $2 with /dev/ & .* removed, defaulting to rmt0
  1154. TAPE=${2:-rmt0}
  1155. TAPE=${TAPE#/dev/}
  1156. TAPE=${TAPE%.*}
  1157.  
  1158. usage()
  1159. {
  1160.     echo "Usage: ./rmksysb <remote_host_name> [<tape_device>] or" >&2
  1161.     echo "       ./rmksysb -l [<tape_device>]" >&2
  1162.     echo "                 with <tape_device>= e.g. rmt1" >&2
  1163.     echo "Default <tape_device>=rmt0" >&2
  1164.     return
  1165. }
  1166.  
  1167. check_parms()
  1168. {
  1169. if [ "${HOST}" = "" ]
  1170. then
  1171.     usage
  1172.     exit 1
  1173. fi
  1174.  
  1175. if [ "${HOST}" = "-l" ]
  1176. then
  1177. # show TOC block which contains some backup details on rmksysb tapes
  1178.     get_tape_block_size
  1179.     chdev -l ${TAPE} -a block_size=${BOOT_BLK_SZ} >/dev/null 2>&1
  1180.     mt -f /dev/${TAPE} rewind
  1181.     mt -f /dev/${TAPE}.1 fsf 2
  1182.     dd if=/dev/${TAPE} count=1 2>/dev/null
  1183.     chdev -l ${TAPE} -a block_size=${OLD_BLK_SZ} >/dev/null 2>&1
  1184.     exit 
  1185. fi
  1186. }
  1187.  
  1188. check_host()
  1189. {
  1190. rsh ${HOST} hostname >/dev/null 2>&1
  1191. if [ $? -ne 0 ]
  1192. then
  1193.     echo "Check hostname & rsh access" >&2
  1194.     exit 1
  1195. fi
  1196. }
  1197.  
  1198. get_tape_block_size()
  1199. {
  1200. VALID=
  1201. `lsdev -Cc tape | cut -f1 -d" " | grep ${TAPE} 2>&1 >/dev/null` && 
  1202.     {
  1203.         OLD_BLK_SZ=`lsattr -El ${TAPE} -a block_size | cut -f2 -d" "`
  1204.         VALID=true
  1205.         }
  1206.  
  1207. if  [ "$VALID" = "" ]
  1208. then
  1209.     echo "Tape drive $TAPE is not a valid local drive!" >&2
  1210.     exit 1
  1211. fi
  1212. }
  1213.  
  1214. #
  1215. # The main procedure is analogous to its C counterpart,
  1216. # This is the basic driver routine.
  1217. #
  1218. main()
  1219. {
  1220.  
  1221. if [ "`id | grep 'uid=0'`" = "" ]
  1222. then 
  1223.     echo "rmksysb can only be run as root!" >&2
  1224.     exit 2 
  1225. fi
  1226. umask 022
  1227.  
  1228. check_parms
  1229. check_host
  1230. get_tape_block_size
  1231.  
  1232. # display some info on this rmksysb session
  1233. echo "`date`\n\nRemote System Backup from remote ${HOST} to local `hostname` on device:\n`lscfg -v -l ${TAPE} | sed -n '3,6p' | grep "[a-z]" `\n" 
  1234.  
  1235. # Here the action starts
  1236. rsh $HOST -n /usr/bin/mkszfile
  1237. rsh $HOST -n "echo ${BLK_SZ} > /tapeblksz"
  1238.  
  1239. rsh $HOST -n "rm -f /tmp/pipe.rmksysb"
  1240. rsh $HOST -n "rm -f /tmp/pipe.rmksysb.out"
  1241. rsh $HOST -n "rm -f /tmp/pipe.rmksysb.err"
  1242.  
  1243. rsh $HOST -n "/etc/mknod /tmp/pipe.rmksysb p"
  1244. rsh $HOST -n "/etc/mknod /tmp/pipe.rmksysb.out p"
  1245. rsh $HOST -n "/etc/mknod /tmp/pipe.rmksysb.err p"
  1246.  
  1247. # create remote startup file for mkinsttape
  1248. rsh $HOST -n "echo '#!/bin/ksh\nexport PATH=$PATH ; /usr/sbin/mkinsttape /tmp/pipe.rmksysb >/tmp/pipe.rmksysb.out 2>/tmp/pipe.rmksysb.err &' > /tmp/mkinsttape.start "
  1249. rsh $HOST -n "chmod 700 /tmp/mkinsttape.start"
  1250.  
  1251. chdev -l $TAPE -a block_size=${BOOT_BLK_SZ} >/dev/null 2>&1
  1252. tctl -f /dev/${TAPE} retension
  1253.  
  1254. echo
  1255. echo
  1256. echo ">>> SAVESET 1: BOS boot image from `hostname`"
  1257. echo
  1258. bosboot -d /dev/${TAPE}.1 -a 
  1259.  
  1260. echo
  1261. echo
  1262. echo ">>> SAVESET 2: BOS install utilities from ${HOST} (backup format)"
  1263. echo
  1264. rsh $HOST -n "nohup /tmp/mkinsttape.start" &
  1265.  
  1266. # get remote standard out & err to local stdout & err
  1267. rsh $HOST -n "dd if=/tmp/pipe.rmksysb.out 2>/dev/null" | dd 2>/dev/null &
  1268. rsh $HOST -n "dd if=/tmp/pipe.rmksysb.err 2>/dev/null" | ( dd 2>/dev/null ) >&2 &
  1269.  
  1270. # get remote mkinsttape to local tape device
  1271. rsh $HOST -n "dd if=/tmp/pipe.rmksysb 2>/dev/null" | dd 2>/dev/null | dd of=/dev/${TAPE}.1 conv=sync 2>/dev/null
  1272.  
  1273. echo
  1274. echo
  1275. echo ">>> SAVESET 3: Backup information (list with ./rmksysb -l [<tapedevice>])"
  1276. echo
  1277. # add dummy TOC to tape with some backup information
  1278. echo "`date`\n\nRemote System Backup from remote ${HOST} to local `hostname` on device:\n`lscfg -v -l ${TAPE} | sed -n '3,6p' | grep "[a-z]" `\n" | dd of=/dev/${TAPE}.1 conv=sync 2>/dev/null
  1279.  
  1280. # change blocksize to 1024 for better performance
  1281. chdev -l ${TAPE} -a block_size=${BLK_SZ} >/dev/null 2>&1
  1282.  
  1283. # rewind & skip first 3 savesets
  1284. mt -f /dev/${TAPE} rewind
  1285. mt -f /dev/${TAPE}.1 fsf 3
  1286.  
  1287. echo
  1288. echo
  1289. echo ">>> SAVESET 4: mksysb (rootvg backup) from ${HOST} (tar format)"
  1290. echo
  1291. # start the actual remote mksysb
  1292. echo "The contents of the /.fs.size file on ${HOST} are:"
  1293. rsh $HOST -n "cat /.fs.size"
  1294. echo
  1295.  
  1296. rsh $HOST -n "nohup /usr/bin/mksysb /tmp/pipe.rmksysb >/tmp/pipe.rmksysb.out 2>/tmp/pipe.rmksysb.err &" &
  1297.  
  1298. # get remote standard out & err to local stdout
  1299. rsh $HOST -n "dd if=/tmp/pipe.rmksysb.out 2>/dev/null" | dd 2>/dev/null &
  1300. rsh $HOST -n "dd if=/tmp/pipe.rmksysb.err 2>/dev/null" | ( dd 2>/dev/null ) >&2 &
  1301.  
  1302. # get remote mksysb to local tape device
  1303. rsh $HOST -n "dd if=/tmp/pipe.rmksysb 2>/dev/null" | dd obs=${BLK_SZ} 2>/dev/null | dd of=/dev/${TAPE} bs=${BLK_SZ} conv=sync 2>/dev/null
  1304.  
  1305. # cleaning up
  1306. rsh $HOST -n "rm -f /tmp/pipe.rmksysb"
  1307. rsh $HOST -n "rm -f /tmp/pipe.rmksysb.out"
  1308. rsh $HOST -n "rm -f /tmp/pipe.rmksysb.err"
  1309. rsh $HOST -n "rm -f /tmp/mkinsttape.start"
  1310.  
  1311. chdev -l ${TAPE} -a block_size=${OLD_BLK_SZ} >/dev/null 2>&1
  1312. umask $UMASK
  1313.  
  1314. # display some closing info on this rmksysb session
  1315. echo "Remote System Backup from remote ${HOST} to local `hostname` is finished.\n`date`\n" 
  1316.  
  1317. } #end of main
  1318.  
  1319. # Call the driver
  1320. main 
  1321.  
  1322.  
  1323. ------------------------------
  1324.  
  1325. Subject: 8.07: How to configure dialup SLIP
  1326.  
  1327. [ formerly in section 1.606 part 5 ]
  1328.  
  1329. #!/bin/ksh
  1330.  
  1331. # SLIP login .profile
  1332. # Adapted from comp.unix.aix FAQ
  1333. # by Davide Migliavacca (davide.migliavacca@inferentia.it)
  1334. # $Revision: 1.14 $
  1335.  
  1336. # Set this variable != 0 to allow multiple logins from this userid
  1337.  
  1338. ALLOW_MULTIPLE_LOGINS=0
  1339.  
  1340. # NOTE: script currently determines destination IP address from the SLIP
  1341. # interface attributes, but it assumes a correspondence
  1342. #     ttyxx <-> slipxx
  1343. # (see the "IPADDRESS=" awk line)
  1344. # It relies on a client being able to read the IP address from
  1345. # the logon procedure output.
  1346.  
  1347.  
  1348. PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:/usr/local/bin:.
  1349.  
  1350. export PATH ENV HISTSIZE
  1351. #
  1352. # Search for a LCK-File for our tty if there is one
  1353. #
  1354. TTYDEV=`tty`
  1355. TTYBASENAME=`basename $TTYDEV`
  1356. TTYNUMBER=`echo $TTYBASENAME | sed -n -e "s/tty\([0-9]\{1,\}\)/\1/p"`
  1357.  
  1358. if [ -f /etc/locks/LCK..$TTYBASENAME ];
  1359. then SHPID=`cat /etc/locks/LCK..$TTYBASENAME`;
  1360. else {
  1361. /usr/bin/logger -t SLIP -p error "No LCK file for $TTYDEV"
  1362.  exit 64;
  1363. }
  1364. fi;
  1365.  
  1366.  
  1367. # Search for another login from this userid
  1368.  
  1369. OTHERSLIP=`ps -fu$USER |
  1370.       sed -n -e "s/^ *$USER  *[0-9][0-9]* .*-.*\/usr\/sbin\/slattach \(tty[0-9]\{1,\}\) *$/\1/p`;
  1371. if [ ! -z "$OTHERSLIP" ];
  1372. then
  1373.    if [ $ALLOW_MULTIPLE_LOGINS -eq 0 ];
  1374.    then
  1375.            echo "Sorry, you are already connected to $OTHERSLIP.";
  1376.            echo "Multiple logins are NOT allowed.";
  1377.            echo "For any question, contact helpdesk@inferentia.it";
  1378.            /usr/bin/logger -t SLIP -p warn "$USER: attempt to connect on $TTYBASENAME when already connected on $OTHERSLIP - refused";
  1379.            exit 64;
  1380.    fi
  1381. #else...
  1382.    /usr/bin/logger -t SLIP -p warn "$USER: multiple login allowed, now using also $TTYBASENAME";
  1383. fi
  1384. #
  1385. # Search for our own Shell to get the PID for checking against LCK-File
  1386. #
  1387.  
  1388. SH2PID=`ps -ft$TTYNUMBER |
  1389.         sed -n -e "s/^ *$USER  *\([0-9][0-9]*\) .*-.*sh *$/\1/p`
  1390.  
  1391. #
  1392. # Is it the the same PID as in the LCK File so that we can start working ??
  1393. DEBUG=0
  1394. if [ $DEBUG -eq 1 ];
  1395. then
  1396.    echo TTYDEV: $TTYDEV
  1397.    echo TTYBASENAME: $TTYBASENAME
  1398.    echo USER: $USER
  1399.    echo SHPID: $SHPID
  1400.    echo SH2PID: $SH2PID
  1401. fi
  1402. if [ "$SHPID" -eq "$SH2PID" ];
  1403. then
  1404. #  remove the LCK-File because slattach does not like it.
  1405.    rm -rf /etc/locks/LCK..$TTYBASENAME
  1406. #  Add RTS/CTS Handshakeing to our own tty: Better do it in /etc/rc,
  1407. #  using the program from the comp.unix.aix FAQ.
  1408. #  stty add rts
  1409.    SLIPLINE=`echo $TTYBASENAME | awk '//{print substr($1,4);}'`
  1410.    IPADDRESS=`lsattr -E -l sl$SLIPLINE -a dest 2>/dev/null | awk '//{print $2;}'`
  1411.    if [ -z "$IPADDRESS" ]
  1412.    then
  1413.    /usr/bin/logger -t SLIP -p error "$USER: attempt to use tty with no slip interface defined ($TTYBASENAME)"
  1414.    echo "This tty ($TTYBASENAME) has not been enabled for SLIP. Please try another one or contact the system administrator."
  1415.    exit 64
  1416.    fi
  1417.    echo SLIP starting. Your IP address is $IPADDRESS
  1418.    /usr/sbin/slattach $TTYBASENAME
  1419. # Get the pid of slattach so that we can kill him later on.
  1420.    SLPID=`ps -aef |
  1421.       sed -n -e "s/^ *$USER  *\([0-9][0-9]*\) .*-.*\/usr\/sbin\/slattach $TTYBASENAME *$/\1/p`
  1422. #  Just say that we are up.
  1423.    logger -t SLIP -p info "$USER: Starting up daemon (pid $SLPID) for [$IPADDRESS] on $TTYDEV"
  1424. else
  1425. # Something must be wrong with the LCK-File
  1426.   SH3PID=`ps -aef | awk ' {print $2}' | grep $SHPID`
  1427.  
  1428.   if [ ."$SH3PID" = ."" ]
  1429.   then
  1430.     SH3PID="NO_SUCH_PROCESS"
  1431.   fi
  1432.  
  1433.   if [ $SHPID = $SH3PID ]
  1434.     then
  1435. #  There is a living process which owns the LCK-File !!
  1436.    /usr/bin/logger -t SLIP -p error "$USER: Cannot remove LCK file for $TTYDEV (not owner)"
  1437.        exit 64
  1438.     else
  1439. #   Who the hell didn't remove the LCK-File (should never happen)
  1440.    /usr/bin/logger -t SLIP -p error "$USER: LCK file for $TTYDEV found with no owner"
  1441.        #echo `date` " LCK-File with no owner found !!!" >>$SLIPLOG
  1442.        exit 64
  1443.     fi
  1444. fi
  1445.  
  1446. if [ $DEBUG -eq 1]
  1447. then
  1448.    /usr/bin/logger -t SLIP -p debug "$USER: going to trap signals..."
  1449. fi
  1450. Nov 28 11:18:46 sauternes rexecd[21420]: connect from brachetto.inferentia.it
  1451.  
  1452.                                                                              # terminated )
  1453. trap "kill $SLPID; /usr/bin/logger -t SLIP -p info \"$USER: Killing daemon (pid $SLPID) for $TTYDEV\"; exit 0" 1
  1454.  
  1455. if [ $DEBUG -eq 1]
  1456. then
  1457.    trap "/usr/bin/logger -t SLIP -p debug \"$USER: trap ERR\"" ERR
  1458.    trap "/usr/bin/logger -t SLIP -p debug \"$USER: trap 0\"" 0
  1459.    trap > /tmp/trap.$TTYBASENAME.log
  1460.    /usr/bin/logger -t SLIP -p debug "$USER: trap returns $?..."
  1461. fi
  1462.  
  1463. # We  will have a nice sleep and nice dreamings
  1464. if [ $DEBUG -eq 1]
  1465. then
  1466.    /usr/bin/logger -t SLIP -p debug "$USER: going to sleep-loop..."
  1467. fi
  1468.  
  1469. while [ true ];
  1470. do
  1471. sleep 60;
  1472. done
  1473.  
  1474. # Sanity check (should never happen...)
  1475. /usr/bin/logger -t SLIP -p error "$USER: ERROR: .profile broken"
  1476.  
  1477. ------------------------------
  1478.  
  1479. Subject: 8.08: Disabling software flow control; using RTS/CTS.
  1480.  
  1481. [ formerly in section 1.613 ]
  1482.  
  1483. /* This program is an adaptation of a program provided by IBM Defect Support.
  1484.    It is provided without warrantee, or support.
  1485.  
  1486.    The syntax of the command is:
  1487.  
  1488.     setrts tty [tty [tty [...]]]
  1489.  
  1490.    The program will loop through each tty provided on the command line, and 
  1491.    turn on the 'rts' line discipline.  The program does not require that
  1492.    the Carrier Detect signal be held high to keep the serial device from 
  1493.    blocking on the attempt to open it.  The program works for all valid ttys.
  1494.  
  1495.    BUGS: None that are known; however, using the program to set 'ptys' may
  1496.    cause the 'pty' to become unusable.
  1497.  
  1498.    This program was written by Robin D. Wilson, Pencom Software (with the
  1499.    specific 'ioctl()' call provided by the IBM Defect Support Center.
  1500.  
  1501.    I call it: "setrts"
  1502.    
  1503.    To compile:
  1504.    cc -O -o setrts setrts.c
  1505.    strip setrts
  1506.    
  1507.    (Funny, but if you strip with the compiler (i.e., cc -s), you end up with
  1508.    120 extra bytes in the executable...)
  1509. */
  1510.  
  1511. #include <stdio.h>
  1512. #include <fcntl.h>
  1513. #include <termios.h>
  1514. #include <sys/tty.h>
  1515. #include <string.h>
  1516. #include <sys/param.h>
  1517. #include <unistd.h>
  1518.  
  1519. #define DEVDIR        "/dev/"
  1520. #define    LINEDISP    "rts"
  1521.  
  1522. main (argc, argv)
  1523. int argc;
  1524. char **argv;
  1525. {
  1526.     int tty;
  1527.     char ttyname[MAXPATHLEN];
  1528.  
  1529. /*    Give a 'usage' recommendation if they don't provide an argument */
  1530.     if (argc < 2) {
  1531.        fprintf(stderr, "usage: %s <ttyn> [ttyn [ttyn [...]]]\n",argv[0]);
  1532.        exit(-1);
  1533.     }
  1534.  /*    Otherwise, loop through all the arguments... */
  1535.     else while (--argc >= 1) {
  1536.         argv++;
  1537.  /*    Check to see if they input the 'tty' names with the DEVDIR on them...
  1538.  *    If not, put it on...
  1539.  */
  1540.         if (strncmp(DEVDIR, argv[0], strlen(DEVDIR)) != 0) {
  1541.             strcpy(ttyname, DEVDIR);
  1542.             strcat(ttyname, argv[0]);
  1543.         }
  1544.         else
  1545.             strcpy(ttyname, argv[0]);
  1546.  
  1547. /*    Open the tty.  Use the non-blocking open (O_NDELAY) to open without a 
  1548.  *    carrier (CD) present on the line...
  1549.  */
  1550.         if ((tty = open(ttyname, O_RDWR|O_NDELAY)) < 0) {
  1551.            fprintf(stderr, "%s: couldn't open tty device.\n",ttyname);
  1552.            exit (-2);
  1553.         }
  1554.  /*    Add the 'rts' line discipline... */
  1555.         (void)ioctl(tty, TXADDCD, LINEDISP);
  1556.         (void)close(tty);
  1557.     }
  1558. }
  1559.  
  1560. ------------------------------
  1561.  
  1562. Subject: 8.09: How can I hack libc.a to alter how hostnames are resolved?
  1563.  
  1564. [ formerly in section 1.618 ]
  1565.  
  1566. [ Editor's note: You might want to see Question 2.07 for advice on
  1567. recovering from a deleted or corrupted libc.a before attempting this
  1568. hack.  Note that this procedure is for AIX 3.2 ONLY --- AIX 4.x already
  1569. has a supported method of controling name resolution.  See question 1.800.]
  1570.  
  1571. 1. get the resolv+ source (I see a copy on ftp.uu.net in networking/ip/dns
  1572.    and there are likely copies elsewhere).  We are using version 2.1.1,
  1573.    which appears to be the latest available.  gethostnamadr.c needs a couple
  1574.    of additions:
  1575.  
  1576.     23a24,26
  1577.     > #ifdef _AIX
  1578.     > #include <sys/time.h>
  1579.     > #endif
  1580.     35a39,41
  1581.     > #ifdef _AIX
  1582.     > #include <sys/ioctl.h>         /* for SIOCGIFCONF */
  1583.     > #else
  1584.     36a43
  1585.     > #endif
  1586.  
  1587. 2. Use the following instead of the supplied shlib/Makefile:
  1588.  
  1589. LIBP=    gethostnamadr.o herror.o res_data.o res_query.o res_mkquery.o \
  1590.     sethostent.o res_send.o res_debug.o res_comp.o res_init.o
  1591. CFLAGS=    -O -D_BSD=43 -D_NO_PROTO -DNIS -DDEBUG -U__STR__
  1592.  
  1593. all: shr.o 
  1594.  
  1595. shr.o:    $(LIBP) setup 
  1596.     ld -o $@ /lib/syscalls.exp $(LIBP) tmp.o -bM:SRE -bE:shr.exp -bE:/lib/syscalls.exp -bI:crypt.imp -H512 -T512 -bh:4 -lc
  1597.  
  1598. setup:
  1599.     rm -f libc.a crypt.imp
  1600.     cp /lib/libc.a .
  1601.     chmod 755 libc.a
  1602.     ar xv libc.a shr.o
  1603.     /bin/dump -nv shr.o | grep EXP | awk '{print $$NF}' > shr.exp
  1604.     ld -o tmp.o -bnso shr.o -r
  1605.     @ echo '#!' > crypt.imp
  1606.     @ echo __crypt >> crypt.imp
  1607.     @ echo __setkey >> crypt.imp
  1608.     @ echo __encrypt >> crypt.imp
  1609.     
  1610. clean:
  1611.     rm -f shr.o tmp.o crypt.imp shr.exp $(LIBP) libc.a
  1612.  
  1613. install_libc:    install_libc.c
  1614.     cc -o $@ install_libc.c -bnso -bI:/lib/syscalls.exp
  1615.  
  1616. herror.o: ../herror.c
  1617.     $(CC) $(CFLAGS) -c ../herror.c
  1618.  
  1619. res_comp.o: ../res_comp.c
  1620.     $(CC) $(CFLAGS) -c ../res_comp.c
  1621.  
  1622. res_debug.o: ../res_debug.c
  1623.     $(CC) $(CFLAGS) -c ../res_debug.c
  1624.  
  1625. res_data.o: ../res_data.c
  1626.     $(CC) $(CFLAGS) -c ../res_data.c
  1627.  
  1628. res_init.o: ../res_init.c
  1629.     $(CC) $(CFLAGS) -c ../res_init.c
  1630.  
  1631. res_mkquery.o: ../res_mkquery.c
  1632.     $(CC) $(CFLAGS) -c ../res_mkquery.c
  1633.  
  1634. res_query.o: ../res_query.c
  1635.     $(CC) $(CFLAGS) -c ../res_query.c
  1636.  
  1637. res_send.o: ../res_send.c
  1638.     $(CC) $(CFLAGS) -c ../res_send.c
  1639.  
  1640. gethostnamadr.o: ../gethostnamadr.c
  1641.     $(CC) $(CFLAGS) -c ../gethostnamadr.c
  1642.  
  1643. sethostent.o: ../sethostent.c
  1644.     $(CC) $(CFLAGS) -c ../sethostent.c
  1645.  
  1646. strpbrk.o: ../strpbrk.c
  1647.     $(CC) $(CFLAGS) -c ../strpbrk.c
  1648.  
  1649. strerror.o: ../strerror.c
  1650.     $(CC) $(CFLAGS) -c ../strerror.c
  1651.  
  1652. 3. As shipped, IBM's /lib/syscalls.exp contains an entry for fork().  This
  1653.    needs to be removed as it will cause the new shr.o to use the system call
  1654.    entry point rather than the library wrapper and this can cause some rather
  1655.    odd behavior.  For example, I ran across one using the '!' command in vi
  1656.    where the error/informational messages were corrupted.
  1657.  
  1658. 4. You can use "ar r libc.a shr.o" but that will leave a big hole in libc.a,
  1659.    since the new shr.o is slightly bigger than the original.  I always extract
  1660.    all the .o's from libc.a and build a brand new one - suit yourself.
  1661.  
  1662. 5. Before the next step, you'll want to set up the two configuration files.
  1663.    The first is /etc/resolv.conf and it is basically the same as before
  1664.    except for the new keyword "search" - intended to replace the "domain".  See
  1665.    the resolver.5 manual page for details (included with the resolv+ source).
  1666.    The other file is /etc/host.conf, which is where you set the order of
  1667.    search.  See resolv+.8 for information on this.
  1668.  
  1669. 6. Now, the only tricky part left is to get the new libc.a installed.  You'll
  1670.    note the Makefile has a target for install_libc.  Just put the following
  1671.    in install_lib.c and run "make install_libc" to build.
  1672.  
  1673. ------------------------------- begin install_libc.c -------------------------
  1674. #include <stdio.h>
  1675.  
  1676. static char *nodns[] = { "/usr/ccs/lib/libc.a" , "/usr/ccs/lib/libc.a.ORIG" };
  1677. static char *hasdns[] = { "/usr/ccs/lib/libc.a.NEW" , "/usr/ccs/lib/libc.a" };
  1678.  
  1679. #define OLD     (0)
  1680. #define NEW     (1)
  1681.  
  1682. main()
  1683. {
  1684.  
  1685.     if(link(nodns[OLD],nodns[NEW])) {
  1686.         perror("link");
  1687.         exit(1);
  1688.     }
  1689.  
  1690.     if(unlink(nodns[OLD])) {
  1691.         perror("unlink");
  1692.         exit(1);
  1693.     }
  1694.  
  1695.     if(link(hasdns[OLD],hasdns[NEW])) {
  1696.         perror("link");
  1697.         exit(1);
  1698.     }
  1699.  
  1700.     if(unlink(hasdns[OLD])) {
  1701.         perror("unlink");
  1702.         exit(1);
  1703.     }
  1704.  
  1705.     exit(0);
  1706. }
  1707. ------------------------------- end install_libc.c ---------------------------
  1708.  
  1709. 7. You'll want to do this on a quiet machine.  Move the new libc.a to
  1710.    /usr/ccs/lib/libc.a.NEW, then run install_libc.  It is probably a good
  1711.    idea to reboot afterwords (though not strictly required).  We have a similar
  1712.    program called restore_libc (exercise for the reader) for backing out the
  1713.    change.
  1714.  
  1715.    Rather than do this on every machine (we have 170+ RS/6000's), I simply
  1716.    put this new libc.a into my network-installable image, which I blasted
  1717.    out over the year-end holiday break (I created a method for loading a new
  1718.    image onto machines without having to boot off of floppies and turn keys).
  1719.  
  1720.    Of course, for the really cautious, you can always make the change after
  1721.    booting off of the maintenance floppies...
  1722.  
  1723. ------------------------------
  1724.  
  1725. Subject: 8.10: How do I make an export list from a library archive?
  1726.  
  1727. [ formerly in section 2.17 ]
  1728.  
  1729. This script will only extract the "export"able names and should be
  1730. useful in starting the shared library creation process. The user must
  1731. determine which names should be included in the import and export lists.
  1732. It's only been tested on a few library archives.
  1733.  
  1734. #!/bin/ksh
  1735. #
  1736. # mkexps - make export list
  1737. # This program creates an export list by combining all the "." and normal names
  1738. # into one list. 
  1739. #
  1740. if [[ "$#" -ne 1 ]]
  1741. then
  1742.     print "Usage: mkexps ArchiveFile"
  1743.     exit -2
  1744. fi
  1745. if [[ ! -f $1 ]] 
  1746. then
  1747.     print "mkexps: Cannot open file \"$1\""
  1748.     exit -1
  1749. fi
  1750. dump -g $1 | awk '
  1751. BEGIN {
  1752.         top = 1
  1753. }    
  1754. /^[ ]*[0-9][0-9]*/ {
  1755.     if ( (n = index( $2, "." )) > 0 ) {
  1756.         export_array[ top++ ] = substr( $2, n+1, length( $2 ))
  1757.     }
  1758.     else {
  1759.     export_array[ top++ ] = $2
  1760.     }
  1761. }
  1762.  
  1763. END {
  1764.     for ( i = 1; i < top; i++ )
  1765.     {
  1766.     print export_array[ i ]
  1767.     }
  1768.  
  1769. }' | sort | uniq
  1770.  
  1771.  
  1772. ------------------------------
  1773.  
  1774. Subject: 9.00: Contributors
  1775.  
  1776. The following persons have contributed to this list.  If you want to
  1777. contribute anonymously, just let me know - but do tell me who you are.
  1778. I apologize if I omitted anyone.
  1779.  
  1780. Thank you all, this would definitely not be the same without _your_ input.
  1781.  
  1782. First and foremost (primus inter pares), Jens-Uwe Mager <jum@anubis.han.de>
  1783. for keeping this FAQ from falling into the Great Bit Bucket (for $$ knows
  1784. how long).
  1785.  
  1786. And all the people that insist on making the difference:
  1787. Luis Basto            <basto@cactus.org>
  1788. Rudy Chukran            <chukran@austin.VNET.IBM.COM>
  1789. Christopher Carlyle O'Callaghan    <asdfjkl@wam.umd.edu>
  1790. Poul-Henning Kamp        <phk@data.fls.dk>
  1791. Richard Wendland                <richard@praxis.co.uk>
  1792. Ge van Geldorp            <ge@dutlru2.tudelft.nl>
  1793. Chris Jacobsen            <jacobsen@sbhep2.phy.sunysb.edu>
  1794. Peter Jeffe            <peter@ski.austin.ibm.com>
  1795. Jean-Francois Panisset        <panisset@thunder.mcrcim.mcgill.edu>
  1796. John Cary            <cary@boulder.colorado.edu>
  1797. Vijay Debbad            <vijay@ingres.com>
  1798. Dick Karpinski            <dick@ccnext.ucsf.edu>
  1799. Konrad Haedener            <haedener@iac.unibe.ch>
  1800. Doug Sewell            <DOUG@YSUB.YSU.EDU>
  1801. David Cordes            <cordes@athos.cs.ua.edu>
  1802. Graeme Moffat            <g.moffat@aukuni.ac.nz>
  1803. Andrew Pierce            <pierce@claven.cambridge.ibm.com>
  1804. Stephen Linam            <sdl@glasnost.austin.ibm.com>
  1805. Jerome Park            <jerome%aixserv@uunet.UU.NET>
  1806. Konrad Haedener            <haedener@iacrs1.unibe.ch> 
  1807. Steve Roseman            <lusgr@chili.CC.Lehigh.Edu>
  1808. John Burton            <burton@asdsun.larc.nasa.gov>
  1809. Thierry Forveille        <FORVEILL@FRGAG51.BITNET>
  1810. Joubert Berger            <afc-tci!joubert>
  1811. Minh Tran-Le            <tranle@intellicorp.com>
  1812. Paul Amaranth            <amaranth@vela.acs.oakland.edu>
  1813. Mark Whetzel            <mark.whetzel@waii.com>
  1814. Daniel Packman            <pack@acd.ucar.edu>
  1815. Ken Bowman            <bowman@uiatma.atmos.uiuc.edu>
  1816. Cary E. Burnette        <kerm@mcnc.org>
  1817. Christophe Wolfhugel        <wolf@grasp1.univ-lyon1.fr>
  1818. Leonard B. Tropiano        <lenny@aixwiz.austin.ibm.com>
  1819. Bill Wohler            <wohler@newt.com>
  1820. James Salter            <jsalter@netscape.com>
  1821. Witold Jan Owoc            <witold@enme.ucalgary.ca>
  1822. Marc Kwiatkowski        <marc@ultra.com>
  1823. Ronald S. Woan            <woan@austin.ibm.com>
  1824. Mijan Huq            <huq@hagar.ph.utexas.edu>
  1825. Herbert van den Bergh        <hbergh@nl.oracle.com>
  1826. Michael Stefanik        <mike@bria.UUCP>
  1827. Julianne F. Haugh        <jfh@austin.ibm.com>
  1828. Ed Kubaitis            <ejk@ux2.cso.uiuc.edu>
  1829. Jaime Vazquez            <jaime@austin.vnet.ibm.com>
  1830. Bjorn Engsig            <bengsig@oracle.com>
  1831. Frank Kraemer             <kraemerf@franvm3.VNET.IBM.COM>
  1832. Andreas Siegert                 <afx@muc.ibm.de>
  1833. Thomas Braunbeck                <braunbec@aixserv.mainz.ibm.de>
  1834. Marc Pawliger            <marc@sti.com>
  1835. Mel Beckman            <mbeckman@mbeckman.mbeckman.com >
  1836. Ole Holm Nielsen        <Ole.H.Nielsen@fysik.dtu.dk>
  1837. David Dennerline        <d.dennerline@bull.com>
  1838. David Alexander            <dave_alexander@rednet.co.uk>
  1839. Ciaran Deignan            <C.Deignan@frec.bull.fr>
  1840. Varouj Vosguian         <Varouj@Planmatics.com>
  1841. Richard Kessler            <71051.1106@compuserve.com>
  1842. Jeff Warrington            <jwarring@aol.net>
  1843. Gary R. Hook            <hook@austin.ibm.com>
  1844. David Edelsohn            <dje@watson.ibm.com>
  1845. Mark Bergman            <mark.bergman@syseca.co.uk>
  1846. Jonathan S. Stibal        <Jonathan_S_Stibal@email.whirlpool.com>
  1847. Charles J. Fisher        <cfisher@bigfoot.com>
  1848. Lawry Simm            <lawry.simm@heywood.co.uk>
  1849. Michael Wojcik            <mww@microfocus.com>
  1850. Matt Willman            <Willman.matt@cnf.com>
  1851. Jan Just Keijser        <KeijserJJ@logica.com>
  1852. Olaf Meeuwissen            <olaf@IMSL.shinshu-u.ac.jp>
  1853. Michael Bhalla            <mbhalla@us.ibm.com>
  1854. Brent Burkholder        <bburk@bicnet.net>
  1855. Joerg Schumacher        <schuma@gaertner.de>
  1856. Frank Winans            <fwinans@yahoo.com>
  1857. Franz Pestenhofer        <franz.pestenhofer@debis.com>
  1858.  
  1859. Opinions expressed here have nothing to do with IBM or my employer.
  1860. In fact, most of these opinions are borrowed from other people :)
  1861.  
  1862. All trademarks are the property of their respective owners.
  1863.  
  1864. $HOME is where the $HEART is.  (but you already knew that)
  1865.