home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1994 June / NEBULA_SE.ISO / Documents / FAQ / AIX-faq / part1 < prev    next >
Encoding:
Internet Message Format  |  1993-08-17  |  45.1 KB

  1. Path: senator-bedfellow.mit.edu!bloom-beacon.mit.edu!gatech!europa.eng.gtefsd.com!uunet!cs.utexas.edu!mavrick!basto@cactus.org
  2. From: basto@cactus.org (Luis Basto)
  3. Newsgroups: comp.unix.aix,news.answers,comp.answers
  4. Subject: AIX Frequently Asked Questions (Part 1 of 3)
  5. Summary: This posting contains a list of Frequently Asked Questions 
  6.          and their answers about AIX, IBM's version of Unix.
  7. Keywords: AIX RS/6000 questions answers
  8. Message-ID: <1451@mavrick.UUCP>
  9. Date: 16 Aug 93 05:09:59 GMT
  10. Expires: 15 Sep 93 01:23:45 GMT
  11. Sender: luis@mavrick.UUCP
  12. Reply-To: basto@cactus.org (Luis Basto)
  13. Followup-To: comp.unix.aix
  14. Lines: 1368
  15. Approved: news-answers-request@MIT.Edu
  16. Supersedes: <1441@mavrick.UUCP>
  17. Xref: senator-bedfellow.mit.edu comp.unix.aix:28916 news.answers:11417 comp.answers:1612
  18.  
  19. Archive-name: aix-faq/part1
  20. Last-modified: August 15, 1993
  21. Version: 2.40
  22.  
  23.  
  24. Version: $Id: aix.faq,v 2.40 93/08/15 basto $
  25.  
  26. I apologise for last month's confusion with part 3 of this list which I
  27. attribute to growing pains.  Section 1 is becoming too unwieldy so I've
  28. reorganized it by topic.  Sysadm questions tend to dominate.  I hope the
  29. rearrangement helps in finding specific items.  Your comments are always
  30. welcome. Warning: Article references may not be completely resolved.
  31.  
  32.  
  33. Frequently Asked Questions to AIX 3.x and IBM RS/6000
  34. _____________________________________________________
  35.  
  36. This posting contains frequently asked questions and answers about the
  37. IBM RS/6000 series workstations and AIX version 3.  All input is very
  38. welcome, please mail to basto@cactus.org.
  39.  
  40. The list is split into three articles to pass thru most mailers.  I'll
  41. usually try to post them once a month to comp.unix.aix, news.answers,
  42. and comp.answers.  Please let your input continue as I am most thankful
  43. for all of it.
  44.  
  45. If you see a From: line it means that whatever follows is either an
  46. unabridged or slightly edited version of the input I have received, and
  47. that I may not have verified its contents.  If there is no From: line, I
  48. probably know what I am talking about, and the entry is edited from
  49. various sources.
  50.  
  51. All entries are numbered with major and minor subject number, e.g. 
  52. 2.11.  If the subject is preceded by an asterisk, that entry has been
  53. changed or added since the last posting.
  54.  
  55. The comp.unix.aix group is for AIX on all IBM platforms -- RT, PS/2,
  56. 370, RS/6000 and mainframes (ESA based on OSF/1), but the traffic has
  57. evolved to discuss predominantly AIX 3.x and the RS/6000.  The
  58. newsgroups comp.sys.ibm.pc.rt and comp.sys.ibm.ps2.hardware cover the
  59. RT, mostly hardware and AOS 4.3, and on PS/2 hardware respectively. 
  60. Mark Whetzel posts FAQ lists about RTs in the rt and *.answers groups.
  61. There are few to non-existent discussions on AIX/370 and AIX/ESA.
  62.  
  63. This article covers only AIX 3.x and the RS/6000, except when noted.
  64.  
  65. If you post questions to comp.unix.aix, please be sure to indicate:
  66.  
  67. - the machine type and brief configuration, e.g. Model 540, 64 MB RAM,
  68.   48 MB swap space (this is actually bad), 1.2 GB XYZ hard drive, etc.
  69.  
  70. - the exact AIX version number, i.e. AIX 3.1 is NOT sufficient, whereas
  71.   AIX 3.1.5 or AIX 3.1 with the 3005 update is.
  72. ______________________________________________________________________________
  73.  
  74. Table of contents:
  75.  
  76. 1.0    General concepts
  77. 1.000  The AIX operating system - what is it?
  78. 1.000  I know neither Unix nor AIX - where do I find more information?
  79. 1.002  What is the Object Database?
  80. 1.003  How do I get rid of the verbose error messages?
  81. 1.004* Which release of AIX do I have?
  82.  
  83. 1.1    SMIT, system administration, file systems
  84. 1.100* I am used to Unix systems programming, why should I learn SMIT?
  85. 1.101* How do I turn off the "running man" in smit?
  86. 1.102  How do I import an /etc/passwd or /etc/group file from another box?
  87. 1.103  Cleaning up utmp, who, and accounting problems
  88. 1.104* How to fsck the root filesystem
  89. 1.105  How can I unmount /usr to run fsck on it?
  90. 1.106  How do I shrink /usr?
  91. 1.107  How do I make a filesystem larger than 2 Gig?
  92. 1.108  How do I see/change system parameters like number of processes per user?
  93. 1.109  How do I shrink the default paging space on hd6?
  94. 1.110  The swapper seems to use enormous amounts of paging space, why?
  95. 1.111  How much paging space do I need?
  96. 1.112  How do I mount a floppy disk as a filesystem?
  97. 1.113  How do I remove a committed lpp?
  98. 1.114* How can I recover space after installing updates?
  99. 1.115  Where are the AIX log files kept?
  100. 1.116* How can I log information about ftp accesses to a file?
  101. 1.117  How do I find a file name from the inode number?
  102. 1.118  How do I set up postscript accounting?
  103. 1.119  How do I create boot diskettes for 3.2?
  104. 1.120  Where can I find tools for performance monitoring?
  105. 1.121  How can I tell what virtual printer a print queue is using?
  106. 1.122  Two srcmstr's are less useful than one?
  107. 1.123* How do I set the tty name associated with a physical port?
  108. 1.124* How do I use mksysb to clone a system?
  109. 1.125* How do I retain timestamps with mksysb?
  110. 1.126* How can I find out the machine type?
  111.  
  112. 1.2    Backups, tape
  113. 1.200  Some info about tape backups
  114. 1.201  How do I do remote backup?
  115. 1.202  How do I backup a multi-disk volume group?
  116. 1.203  How do I put multiple backups on a single 8mm tape?
  117. 1.204  How can I make an exact duplicate of a tape over the network?
  118.  
  119. 1.3    Memory and process management
  120. 1.300  Some info about the memory management system
  121. 1.301  How much should I trust the ps memory reports?
  122.  
  123. 1.4    Shells, commands, man pages, InfoExplorer
  124. 1.400  How do I make an informative prompt in the shell?
  125. 1.401  How do I set up ksh for emacs mode command line editing?
  126. 1.402  Listing files with ls causes a core dump
  127. 1.403  How do I put my own text into InfoExplorer?
  128. 1.404  InfoExplorer ASCII key bindings 
  129. 1.405  How can I add new man pages to the system?
  130.  
  131. 1.5    Video, Graphics, X11
  132. 1.500* Which release of X11 do I have?
  133. 1.501* How to prevent ctrl-alt-backspace from killing the X session
  134. 1.502  Who has a termcap/terminfo source for aixterm or the HFT console?
  135. 1.503  How can I look at PostScript files?  Why is "dpsexec" so lousy?
  136. 1.504  unix:0 vs `hostname`:0
  137. 1.505  VT100 key bindings for aixterm
  138.  
  139. 1.6    Networks and communications
  140. 1.600  My named dies frequently, why?
  141. 1.601  How do I trace ethernet packets on an AIX system?
  142. 1.602  What is the authorized way of starting automount at boot time?
  143. 1.603  How do I set a tty port for both dial-in and dial-out?
  144. 1.604  How to move or copy whole directory trees across a network
  145. 1.605  How can I send mail to hosts that cannot be pinged?
  146. 1.606  How to setup dialup SLIP
  147.  
  148. 1.7
  149. 1.8
  150.  
  151. 1.9    Miscellaneous
  152. 1.900  SCSI-1 and SCSI-2 "interoperability" got you confused?
  153. 1.901  How to get your keyboard back after unplugging it from the 6000
  154. 1.902  How do I set up pcsim, the DOS emulator?
  155. 1.903  How do I transfer files between AIX and DOS disks?
  156.  
  157.  
  158. 2.00  C/C++
  159. 2.01  I cannot make alloca work
  160. 2.02  How do I compile my BSD programs?
  161. 2.03  Isn't the linker different from what I am used to?
  162. 2.04  How do I link my program with a non-shared /lib/libc.a?
  163. 2.05  How do I make my own shared library?
  164. 2.06  Linking my program fails with strange error, why?
  165. 2.07  What's with malloc()?
  166. 2.08  Why does xlc complain about 'extern char *strcpy()'
  167. 2.09  Why do I get 'Parameter list cannot contain fewer ....'
  168. 2.10  Why does xlc complain about '(sometype *)somepointer = something'
  169. 2.11  Some more common errors
  170. 2.12  Can the compiler generate assembler code?
  171. 2.13  Curses
  172. 2.14* How do I speed up linking?
  173. 2.15  What is deadbeef?
  174. 2.16  How do I statically link in 3.2?
  175.  
  176. 3.00  Fortran and other compilers
  177. 3.01  I have problems mixing fortran and C code, why?
  178. 3.02  How do I statically bind fortran libraries and dynamically bind
  179.       C libraries?
  180. 3.03  How do I check if a number is NaN?
  181. 3.04  Some info sources on IEEE floating point
  182.  
  183. 4.00  GNU and Public Domain software
  184. 4.01  How do I find PD software?
  185. 4.02* Are there any ftp sites?
  186. 4.03  General hints
  187. 4.04  GNU Emacs
  188. 4.05  gcc/gdb
  189. 4.06  GNU Ghostscript
  190. 4.07  TeX
  191. 4.08  Perl
  192. 4.09  X-Windows
  193. 4.10  bash
  194. 4.11  Elm
  195. 4.12  Oberon 2.2
  196. 4.13  Kermit
  197. 4.14  Gnu dbm
  198. 4.15  tcsh
  199. 4.16  Kyoto Common Lisp
  200. 4.17  Tcl/Tk
  201. 4.18  Expect
  202. 4.19  Public domain software on CD
  203.  
  204. 5.00  Third party products
  205. 5.01  IBM List of third party products
  206. 5.02* Disk/Tape/SCSI
  207. 5.03* Memory
  208. 5.04  Others
  209. 5.05  C++ compilers
  210.  
  211. 6.00  Miscellaneous other stuff
  212. 6.01  Can I get support by e-mail?
  213. 6.02  List of useful faxes
  214. 6.03  List of 3.2 ptfs
  215. 6.04  Some RS232 hints
  216. 6.05* What publications are available for AIX and RS/6000?
  217. 6.06* Some acronyms
  218. 6.07* How do I get this by mailserver or ftp?
  219. 6.08* Where can I send suggestions for tools?
  220.  
  221. 7.00* Contributors
  222.  
  223. ______________________________________________________________________________
  224. 1.000: The AIX operating system - what is it?
  225.  
  226. This is best answered by reading the text files in /usr/lpp/bos.  The
  227. README file there contains general information and the bsdadm file
  228. contains useful information if you know BSD and/or SystemV.
  229.  
  230. The last release for the RT PC is 2.2.1. The latest release for 
  231. PS/2s and Intel architecture machines is AIX 1.3; for PS/2s only, 1.2.1.
  232. For the RS/6000, there are two major levels, 3.1 and 3.2, and various
  233. intermediate levels.
  234.  
  235.  
  236. 1.001: I know neither Unix nor AIX - where do I find more information?
  237.  
  238. Quite a number of questions posted to comp.unix.aix show that AIX is
  239. people's first experience with Unix.  If this is the case with you, you
  240. are advised to look at the other newsgroups in the comp.unix hierarchy,
  241. in particular comp.unix.questions (for basic questions) or
  242. comp.unix.wizards (for difficult questions).  These two groups have a
  243. common FAQ posting as well.
  244.  
  245. If you need information about C programming, try comp.lang.c or comp.std.c,
  246. the latter for Standard ANSI C issues.  comp.lang.c has a FAQ posting.
  247.  
  248.  
  249. 1.002: What is the Object Database?
  250.  
  251. The Object Database Manager, ODM, stored in /etc/objrepos,
  252. /usr/lib/objrepos, and /usr/share/lib/objrepos is AIX's way of storing
  253. all the system management information.  Under most circumstances, only
  254. SMIT or the commands SMIT call (see 1.100) should be used to change the
  255. ODM.
  256.  
  257. A harmless way to look at the ODM is to use odmget <Class> where <Class>
  258. is one of the files in /etc/objrepos.
  259.  
  260. The very interested user can use the ODM editor, odme, to navigate the
  261. ODM in detail.  Modifying the ODM should only be attempted if you know
  262. exactly what you are doing.
  263.  
  264.  
  265. 1.003: How do I get rid of the verbose error messages?
  266.  
  267. Many of the messages from the Unix commands are available in different
  268. languages.  This is controlled by the LANG environment variable, the
  269. default being En_US meaning English in the US.  All the default messages
  270. have a message number associated with them, e.g.:
  271.  
  272. $ cat no-such-file
  273. cat: 0652-050 Cannot open no-such-file.
  274.  
  275. If you prefer the terser Unix-looking error message, set your
  276. environment LANG to C, and you will get:
  277.  
  278. $ cat no-such-file
  279. cat: Cannot open no-such-file.
  280.  
  281.  
  282. 1.004: Which release of AIX or other products do I have?
  283.  
  284. The command 'lslpp -h bos.obj' will show all lines referring to the BOS, 
  285. Basic Operating System.  E.g.:
  286.  
  287. Option Name          State      Event      Date      Release         User Name
  288. -------------------- ---------- ---------- --------- --------------- ---------
  289. bos.obj              INACTIVE   COMMIT     02/03/90  03.01.0000.0000 root
  290.                      INACTIVE   APPLY      06/25/90  03.01.0000.0001 root
  291.                      INACTIVE   COMMIT     06/25/90  03.01.0000.0001 root
  292.                      INACTIVE   APPLY      11/16/90  03.01.0002.0015 root
  293.                      INACTIVE   COMMIT     11/16/90  03.01.0002.0015 root
  294.              ACTIVE     COMMIT     05/07/91  03.01.0005.0012 root
  295.  
  296. gives the history for the BOS lpp.  The last line, column four, indicates
  297. that this is release 3.1.5.
  298.  
  299. To see a listing of everything installed use lslpp -l '*', then use
  300. lslpp with the -h option as above to get a history of a particular lpp. 
  301.  
  302. 3.1.5 is considered the "base" release for users running 3.1.  You
  303. should be at least at this level.  If you request a ptf update you will
  304. get 2010.  If you are at some level earlier than 3.1.5, you must first
  305. apply 3.1.5, then 2010.  Customers using SNA should request the SNA
  306. Quality Refresh update.  Support for 3.1 will end on December 31, 1993.
  307.  
  308. For AIX 3.2, it's a completely different scheme.  You may come across
  309. discussions on releases 3.2.0, 3.2.1, 3.2.2, 3.2.3 and 3.2.3 extended. 
  310. There is no absolute way to tell which of these you are running since
  311. the newer releases are simply 3.2.0 with some sets of PTFs added.  These
  312. selective fixes could mean there are literally thousands of slightly
  313. different variations of 3.2 in use.  Please see section 6 to request
  314. some useful faxes to help with this number game.
  315.  
  316. AIX 3.2.4 resolves this confusion with a new option for lslpp.  Use
  317. 'lslpp -m bos.obj' to show what level and update the system is running.
  318.  
  319. ______________________________________________________________________________
  320. 1.100: I am used to Unix systems programming, why should I learn SMIT?
  321.  
  322. Using SMIT is probably very different from your normal way of doing
  323. system administration, but could prove very useful in the long run.  In
  324. some areas, in particular TCP/IP, NFS, etc., you also have the
  325. possibility of doing things the "normal" way, but it is unfortunately
  326. difficult to know exactly when the "normal" way works.  Again, always
  327. using SMIT, is probably your best way to go, even when you have to learn
  328. a new tool.
  329.  
  330. What SMIT actually does is build up commands with all required options
  331. to perform the functions requested and execute them.  The commands
  332. called and the output they produce are stored in the files smit.script
  333. and smit.log in your home directory.  Looking in smit.script may teach
  334. you more about system administration.
  335.  
  336.  
  337. 1.101: How do I turn off the "running man" in smit?
  338.  
  339. Use smitty, the standard curses version or add this line to your .kshrc file:
  340. alias smit="smit -C"
  341.  
  342.  
  343. 1.102: How do I import an /etc/passwd or /etc/group file from another box?
  344.  
  345. Make sure that you run usrck, pwdck (/etc/passwd), and grpck
  346. (/etc/group) to let AIX work its password/group magic.
  347.  
  348.  
  349. 1.103: Cleaning up utmp, who, and accounting problems
  350. From: fritz@scipp.UCSC.EDU (Frederick Staats)
  351.  
  352. This applies if you are running an X11R5 xterm on 3.2.
  353. Add this to the top of X11R5 mit/clients/xterm/main.c:
  354.  
  355. #ifdef AIXV3
  356. #define USE_SYSV_UTMP
  357. #define HAS_UTMP_UT_HOST
  358. #define WTMP_FILENAME "/var/adm/wtmp"
  359. #endif
  360.  
  361. And your utmp problems should go away.  If you want xterminal sessions
  362. to go into the wtmp file you need to define -DWTMP in the Imakefile and
  363. be sure the WTMP_FILENAME is set to the right place.
  364.  
  365. The following program by jfh@rpp386.cactus.org (John F. Haugh)
  366. if run in the background by root will clean up the utmp file.
  367.  
  368. #include <sys/types.h>
  369. #include <utmp.h>
  370. #include <fcntl.h>
  371.  
  372. main ()
  373. {
  374.     int    fd;
  375.     struct    utmp    utmp;
  376.  
  377.     while (1) {
  378.         if ((fd = open ("/etc/utmp", O_RDWR)) < 0)
  379.             exit (1);
  380.  
  381.         while (read (fd, &utmp, sizeof utmp) == sizeof utmp) {
  382.             if (utmp.ut_type == USER_PROCESS &&
  383.                     kill (utmp.ut_pid, 0) != 0) {
  384.                 lseek (fd, - (long) sizeof utmp, 1);
  385.                 utmp.ut_type = DEAD_PROCESS;
  386.                 write (fd, &utmp, sizeof utmp);
  387.             }
  388.         }
  389.         close (fd);
  390.         sleep (60);
  391.     }
  392. }
  393.  
  394. Another utmp program was posted to comp.sources.unix, volume 25, issue
  395. 96 by David W. Sanderson (dws@cs.wisc.edu) that also works on AIX 3.1.
  396.  
  397.  
  398. 1.104: How to fsck the root filesystem
  399.  
  400. You can run fsck either in maintenance mode or on mounted filesystems.
  401. To enter maintenance mode to run fsck on the root filesystem:
  402.  
  403.   1. boot from diskette
  404.   2. select maintenance mode
  405.   3. type /etc/continue hdisk0 exit (replace hdisk0 with boot disk if
  406.      not hdisk0)
  407.   4. fsck /dev/hd4
  408.  
  409.  
  410. 1.105: How can I unmount /usr to run fsck on it?
  411. From: accapadi@mathew.austin.ibm.com (Matt Accapadi)
  412. [ This is for 3.2. ]
  413.  
  414. In order to fsck /usr, it has to be unmounted.  But /usr cannot be
  415. unmounted because /bin is symbolically linked to /usr/bin.  Also
  416. /etc/fsck is symbolically linked to /usr/sbin/fsck.
  417.  
  418. To work around this, when you boot from the boot/maintenance diskettes
  419. and enter maintenance mode, enter "getrootfs hdisk0 sh" instead of
  420. "getrootfs hdisk0" where hdisk0 is the name of the boot disk.  Then run
  421. "fsck /dev/hd2".
  422.  
  423.  
  424. 1.106: How do I shrink /usr?
  425. From: mike@bria.UUCP (Michael Stefanik) and Richard Hasting
  426.  
  427. FOR AIX 3.1
  428. -----------
  429.  
  430.  1) Make a backup of /usr
  431.  
  432.         find /usr -print | backup -ivf /dev/rmt0 (or appropriate device)
  433.  
  434.  2) shutdown to maintenance mode
  435.  
  436.         shutdown -Fm
  437.  
  438.  3) export LANG=C
  439.  
  440.  4) remove the filesystem and the logical volume
  441.     ignore an error about the "dspmsg" command not found
  442.  
  443.         umount /usr
  444.         rmfs /usr
  445.  
  446.  5) make a new logical volume hd2 and place it on rootvg with desired size
  447.  
  448.         mklv -yhd2 -a'e' rootvg NNN 
  449.  
  450.    where NNN is the number of 4 meg partitions
  451.  
  452.  6) create a filesystem on /dev/hd2
  453.  
  454.         crfs -vjfs -dhd2 -m'/usr' -Ayes -p'rw'
  455.  
  456.  7) mount the new /usr filesystem and check it
  457.  
  458.         /etc/mount /usr
  459.         df -v
  460.  
  461.  8) restore from the tape; system won't reboot otherwise
  462.  
  463.         restore -xvf/dev/rmt0
  464.  
  465.  9) Sync and reboot the system; you now have a smaller /usr filesystem
  466.  
  467. FOR AIX 3.2
  468. -----------
  469.  
  470.  1) Remove any unneeded files from /usr.
  471.  
  472.  2) Make sure all filesystems in the root volume group are mounted. If
  473.     not, they will not be included in the re-installed system.
  474.  
  475.  3) Type "mkszfile". This will create "/.fs.size" that contains a list
  476.     of the active filesystems in the root volume group that will be
  477.     included in the installation procedure.
  478.  
  479.  4) Edit .fs.size. Change the size of /usr to what you want.
  480.  
  481.     Example: This .fs.size file shows /usr to be 40MB.
  482.  
  483.     rootvg 4 hd2 /usr 10 40 jfs
  484.  
  485.     The number 10 is the number of physical partitions for the filesystem
  486.     and the 40 is 40 MB. Most systems have a physical partition
  487.     size of 4 MB. Therefore, the second number (40) will always be
  488.     4 times the previous number (10). Note, however, that a model 320
  489.     with a 120 MB drive will have a physical partition size of only 2 MB,
  490.     and the total MB is therefore twice the number of physical partitions.
  491.     The first number (4) in the .fs.size file represents the PP size.
  492.  
  493.     If you want to reduce the size of /usr from 40 MB to 32 MB, 
  494.     edit the /usr entry to:
  495.  
  496.         rootvg 4 hd2 /usr 8 32 jfs
  497.  
  498.     IMPORTANT: Make sure that you DO NOT enter a value which is less
  499.     than the size of the filesystem required to contain the current
  500.     data. Doing so will cause the re-installation procedure to fail.
  501.  
  502.  5) chdev -l rmt0 -a block=512 -T
  503.  
  504.  6) Unmount all filesystems that are NOT in the root volume group.
  505.  
  506.  7) Varyoff all user-defined volume groups, if any
  507.  
  508.         varyoffvg VGname
  509.  
  510.  8) Export the user-defined volume groups, if any
  511.  
  512.         exportvg VGname
  513.  
  514.  9) With a tape in the tape drive, type
  515.  
  516.         mksysb /dev/rmt0
  517.  
  518.      This will do a complete system backup, which will include
  519.      information (in the .fs.size file) for the installation procedure
  520.      on how large the filesystems are to be created.
  521.  
  522.  10) Follow the instructions in the Installation Kit under "How to
  523.      Install and perform maintenance from Diskettes" using the
  524.      diskettes and tape that you created in the previous steps.
  525.      DO NOT select the option "Reinstall AIX with Current System
  526.      Settings" during the install procedure. The new system must be
  527.      installed using the option "Install AIX with Current System
  528.      Settings" for the logical volume size changes to take affect.
  529.  
  530.  11) When the operating system installation is complete, you may then
  531.      import the information into your newly installed operating system
  532.      for any user-defined volume groups.
  533.  
  534.          importvg -y VGname PVname
  535.  
  536.      where "VGname" is the name of the volume group, and "PVname" is
  537.      the name of any one of the physical volumes in the volume group.
  538.  
  539.  12) Varyon your user-defined volume groups
  540.  
  541.          varyonvg VGname
  542.  
  543.  The reduction of the filesystems is now complete.
  544.  
  545.  
  546. 1.107: How do I make a filesystem larger than 2 Gig?
  547.  
  548. The largest filesystem under AIX is 2 Gigabytes because the largest
  549. signed integer is 2**31 - 1.
  550.  
  551.  
  552. 1.108: How do I see/change system parameters like number of processes per user?
  553.  
  554. You can use SMIT as described below or simply use the lsattr/chdev pair. 
  555. The former will list the current setting as in:
  556.  
  557.   # lsattr -E -l sys0 -a maxuproc
  558.   maxuproc 40 Maximum # of processes allowed per user True
  559.  
  560. and you can then increase the maxuproc parameter:
  561.  
  562.   # chdev -l sys0 -a maxuproc=200
  563.   sys0 changed
  564.  
  565. If you just type 'lsattr -E -l sys0' you will get a list of all parameters,
  566. some of which can be changed but not others.
  567.  
  568. If you want to use smit, this procedure can be followed:
  569.  
  570. smit
  571.   System Environments and Processes
  572.     Change / Show Operating System Parameters
  573.       - on this screen you can change by overtyping the following fields:
  574.         - Maximum number of PROCESSES allowed per user
  575.         - Maximum number of pages in block I/O BUFFER CACHE
  576.         - Maximum Kbytes of real memory allowed for MBUFS
  577.       - toggle fields exist for:
  578.         - Automatically REBOOT system after a crash  (false/true)
  579.         - Continuously maintain DISK I/O history (true/false)
  580.  
  581.  
  582. 1.109: How do I shrink the default paging space on hd6?
  583.  
  584. 1) create a paging space to use temporarily
  585.    mkps -s 20 -a rootvg
  586.  
  587. 2) change default paging space hd6 so it is not used at next reboot
  588.    chps -a n hd6
  589.  
  590. 3) For AIX 3.1, edit /etc/rc.boot4 and change swapon /dev/hd6;
  591.    for AIX 3.2, edit /sbin/rc.boot and change swapon /dev/hd6
  592.    swapon /dev/paging00
  593.  
  594. 4) Update information in boot logical volume
  595.    bosboot -a             (3.1)
  596.    bosboot -a -d hdisk0   (3.2)
  597.  
  598. 5) shutdown and reboot
  599.  
  600. 6) remove current hd6 and create a new one of smaller size
  601.    rmps hd6
  602.    mklv -y hd6 -t paging rootvg <size of PS in 4 Meg blocks>
  603.  
  604. 7) Re-edit /etc/rc.boot4 (3.1), /sbin/rc.boot (3.2) to swap to /dev/hd6
  605.    swapon /dev/hd6
  606.  
  607. 8) Update information in boot logical volume
  608.    bosboot -a             (3.1)
  609.    bosboot -a -d hdisk0   (3.2)
  610.  
  611. 9) change current paging device (paging00) so it is inactive at next boot
  612.    chps -a n /dev/paging00
  613.  
  614. 10) shutdown, reboot, remove paging00 using the command:
  615.     rmps paging00
  616.  
  617.  
  618. 1.110: The swapper seems to use enormous amounts of paging space, why?
  619.  
  620. When you run ps, you may see a line like:
  621.  
  622. USER   PID %CPU %MEM    SZ   RSS     TT STAT  TIME CMD
  623. root     0 0.0%  14% 386528  8688      -    S 17:06 swapper
  624.  
  625. This is normal behavior, the swapper looks to ps like it has the entire
  626. paging space plus real memory allocated.
  627.  
  628.  
  629. 1.111: How much paging space do I need?
  630.  
  631. The rule of thumb is paging space = 2 times physical memory. For example,
  632. if your system has 48 MB of RAM, you want to allocate 96 MB for paging.
  633. However, this is application dependent. If you do software development,
  634. especially large projects, then you should consider this rule. But if your
  635. system has 512 MB memory, you may not need 1 Gig of paging. Use 'lsps -a'
  636. during typical system loading to determine if your system is thrashing.
  637. Never allocate less paging space than physical memory or performance 
  638. will suffer seriously.
  639.  
  640.  
  641. 1.112: How do I mount a floppy disk as a filesystem?
  642. From: op@holmes.acc.Virginia.EDU (Olaf Pors)
  643.  
  644. You can build a filesystem on a floppy and mount it, however the
  645. filesystem will be read only.  The reason that the filesystem will be
  646. read only is because AIX Version 3.1.5 cannot create a journal log on a
  647. diskette.  The intended use is for temporary access to the read only
  648. data.  The diskette file system must be unmounted after use and during
  649. system backup procedures or errors could occur.
  650.  
  651. To make the read only filesystem on a floppy:
  652.  
  653. 1. Make a subdirectory on an existing filesystem on the hard disk and
  654.    place all of the files that the diskette will contain into this
  655.    subdirectory.
  656.  
  657. 2. Enter the following command to create a prototype file containing
  658.    information about the new filesystem, in the example /dir_struct
  659.    is the pathname of the subdirectory created in step 1, and
  660.    proto_filename is the name of the prototype file to be created.
  661.  
  662.          proto /dir_struct > proto_filename
  663.  
  664. 3. Place your floppy disk into the drive and format it.
  665.  
  666. 4. Edit the prototype file and replace the first line with the following:
  667.  
  668.          <noboot> 0 0
  669.  
  670. 5. Enter the following command to make the filesystem on your floppy:
  671.  
  672.           mkfs -p proto_filename -V jfs /dev/fd0
  673.  
  674. 6. Create the directory upon which you will mount the floppy based
  675.    filesystem, or you can use the /mnt directory.  Enter the following
  676.    command to mount the filesystem:
  677.  
  678.           mount -r -V jfs /dev/fd0 /your_mount_point
  679.  
  680. 7. To unmount the filesystem, use the command:
  681.  
  682.           umount /dev/fd0
  683.  
  684. Since the filesystem is read-only it may be of limited use but if you
  685. are going to use it for utility programs and other data that does not
  686. change much, it still may be useful.  If you need to change the data,
  687. you can copy the directory from the floppy into another directory, make
  688. your modifications, and remake the filesystem using this procedure.
  689.  
  690.  
  691. 1.113: How do I remove a committed lpp?
  692. From: drb@chmeds.ac.nz (Ross Boswell)
  693.  
  694. This seems to be a common problem.  I got the following script from IBM
  695. NZ AIX software support.  As far as I know, it works -- I used it to
  696. remove unwanted fonts.  I have no official permission to post it -- use
  697. it at your own risk! This script only works on AIX 3.2.
  698.  
  699. #!/bin/ksh
  700. #
  701. # Permanently remove a product from disk and AIX databases
  702. #
  703.  
  704. if [ `whoami` != "root" ] ; then
  705.   echo You must be root to run this script.
  706.   exit 1
  707. fi
  708.  
  709. if [ `uname -a | awk '{print $1$4$3}'` != "AIX32" ] ; then
  710.   echo This script only works on AIX 3.2.
  711.   exit 1
  712. fi
  713.  
  714. TMP_FREE=`df /tmp | awk '$3 ~ /[0-9]/{print $3}'`
  715. if [ "$TMP_FREE" -lt 1000 ] ; then
  716.    echo There is not enough room in your /tmp directory.
  717.    echo You need 1000 KB free, and you have only $TMP_FREE KB free.
  718.    echo Either remove some stuff from /tmp, or use chfs to make it bigger.
  719.    exit 1
  720. fi
  721.  
  722. ODMDIRS="/etc/objrepos /usr/lib/objrepos /usr/share/lib/objrepos"
  723. ODMDIR=/usr/lib/objrepos
  724. export ODMDIR
  725.  
  726. if [ $# -lt 1 ]
  727. then
  728.   echo usage: $0 lppname [lppname ...]
  729.   echo lppname is a string compatible with grep, ie "X11" or "PHIGS"
  730.   echo typing   $0 PHIGS   will remove all LPPs with PHIGS in their name.
  731.   exit 1
  732. fi
  733.  
  734. NAMES=$1
  735. shift
  736. while [ $# -gt 0 ] ; do
  737.   NAMES="$NAMES|$1"
  738.   shift
  739. done
  740. echo "Searching for lpps with egrep \"$NAMES\"...\c"
  741.  
  742. for ODMDIR in $ODMDIRS ; do
  743.   if [ ! -d $ODMDIR -o ! -w $ODMDIR ] ; then
  744.      echo $ODMDIR is not writeable or is not a directory.
  745.      echo I hope this is because you are a /usr client or diskless.
  746.      echo If you are not a diskless or a /usr client, you should stop.
  747.      echo "Enter y to continue ->\c"
  748.      read answer
  749.      if [ "$answer" != "y" ] ; then
  750.        exit 0
  751.      fi 
  752.   fi
  753.   TMP=`odmget lpp | awk -F\" '/name/ {print $2}' | egrep "$NAMES"`
  754.   LPPS=`echo $LPPS $TMP`
  755. done
  756.  
  757. if [ "$LPPS" = "" ]
  758. then
  759.   echo "failed.\nNo LPP with the name $NAMES detected."
  760.   exit 1
  761. fi
  762. echo ok.
  763.  
  764. for ODMDIR in $ODMDIRS ; do
  765.   mkdir -p /tmp/rmlpp/$ODMDIR > /dev/null 2>&1
  766. done
  767.  
  768. > /tmp/listOfFilesToRM$$    # truncate temporary file, just in case.
  769. echo
  770. echo This script is about to attempt to remove an LPP from your system.
  771. echo I say attempt, because it could fail.  If it fails, you may have
  772. echo to at least reload the LPP.  Use the \"lppchk\" command to make sure
  773. echo all is well with your system.
  774. echo
  775. # Loop through all the LPP names found.
  776. for LPP in $LPPS
  777. do
  778.   DESCR=none
  779.   answer=""
  780.  
  781.   # find the LPP ids.  They will be different in the three SWVPD databases.
  782.   for ODMDIR in $ODMDIRS ; do
  783.     # get the lpp id for this ODMDIR (yes, they are different)
  784.     LPPID=`odmget -q name=$LPP lpp | grep lpp_id | sed 's/.* = //'`
  785.  
  786.     # did we find the LPP?
  787.     if [ "$DESCR" = "none" -a "$LPPID" != ""  ] ; then
  788.       # all the descriptions should be the same
  789.       DESCR=`odmget -q name=$LPP lpp | grep description | sed 's/.* = //'`
  790.       echo "Delete $LPP, $DESCR?"
  791.       echo "y or (n) ->\c"
  792.       read answer
  793.       if [ "$answer" != "y" ] ; then # jump back up to the next LPP name
  794.         continue 2
  795.       fi
  796.     fi
  797.     # if there is no DESCR, then we didn't find the LPP.  Weird.
  798.     if [ "$DESCR" = "none" -o "$LPPID" = "" ] ; then
  799.       continue
  800.     fi
  801.     SOMETHING_DONE_FLAG=true
  802.     # Optionally, save the ODM stuff we are about to remove,
  803.     # in case something goes wrong.  The problem is it is difficult
  804.     # to determine if something really did fail, since these commands
  805.     # don't return any decent error return codes.
  806.     odmget -q lpp_id=$LPPID history   > /tmp/rmlpp/$ODMDIR/$LPP.history
  807.     odmget -q name=$LPP lpp           > /tmp/rmlpp/$ODMDIR/$LPP.lpp
  808.     odmget -q lpp_name=$LPP product   > /tmp/rmlpp/$ODMDIR/$LPP.product
  809.     # Get the list of files and links to remove later....
  810.     odmget -q lpp_id=$LPPID inventory > /tmp/rmlpp/$ODMDIR/$LPP.inventory
  811.     awk -F\" '/loc/ {print $2}' /tmp/rmlpp/$ODMDIR/$LPP.inventory | \
  812.       sed 's/,/ /g' >> /tmp/listOfFilesToRM$$
  813.     odmdelete -o history -q lpp_id=$LPPID   > /dev/null 2>&1
  814.     odmdelete -o lpp -q name=$LPP           > /dev/null 2>&1
  815.     odmdelete -o product -q lpp_name=$LPP   > /dev/null 2>&1
  816.     odmdelete -o inventory -q lpp_id=$LPPID > /dev/null 2>&1
  817.   done
  818. done
  819.  
  820. if [ "$SOMETHING_DONE_FLAG" = "true" ] ; then
  821.  
  822.   echo ODM work is done.  Now, time to delete files....
  823.  
  824.   # This could be catastrophic if there is a problem.  For example,
  825.   # if the ODM database for an application had / as one of its files.
  826.   # You be the judge.  Here's your rope....
  827.   cat /tmp/listOfFilesToRM$$ | sort -r | uniq | xargs rm -rf
  828.  
  829.   rm -rf /tmp/listOfFilesToRM$$
  830.   echo done.
  831. fi
  832.  
  833. # take this line out if you want to save your ODM saved files.
  834. rm -rf /tmp/rmlpp
  835.  
  836. exit 0
  837.  
  838.  
  839. 1.114: How can I recover space after installing updates?
  840. From: Milt Cloud <cloud@ux1.cso.uiuc.edu>
  841.  
  842. Note: If you are a /usr server, do not use this because the files
  843.       mentioned below are needed by /usr clients and cannot be deleted.
  844.  
  845. Installp creates numerous files in /usr to clean up after
  846. failed/rejected installs and also for de-installing uncommitted lpps. 
  847. Once you have COMMITted packages you can remove these files safely. 
  848. Depending on your installation activity the numbers can be significant
  849. here: hundreds-to-thousands of files, megabytes of data.
  850.  
  851. Files eligible for removal are associated with each "product" you have
  852. installed; the largest collection being due to bos.  After
  853. COMMITting bos lpps, you may safely remove all files of the form:
  854.  
  855.               /usr/lpp/bos/deinstl*
  856.               /usr/lpp/bos/inst_U4*
  857.               /usr/lpp/bosadt/deinstl*
  858.         and   /usr/lpp/bosadt/inst_U4*
  859.  
  860. You may repeat this for all additional COMMITted products (e.g.,
  861. bostext1, bosnet, xlc) you have on your system.
  862.  
  863. This problem of lingering install files is a known defect in installp. 
  864. If you have installed PTF U411711 (or any superceder of it: U412397,
  865. U413366, U413425) the deadwood in /usr will not be quite as prevalent. 
  866. No single PTF currently available completely corrects this problem.
  867.  
  868. On my own 320, the following freed up 12.4M in /usr:
  869.  
  870.        # rm -R /usr/lpp/bos/deinstl*
  871.        # rm -R /usr/lpp/bos/inst_U4*
  872.  
  873.  
  874. 1.115: Where are the AIX log files kept?
  875. From: dirk@kimosabi.ucsc.edu (Dirk Coldewey)
  876.  
  877. Such as the equivalent of the SunOS file '/var/log/syslog' and 
  878. '/var/adm/messages'.
  879.  
  880. If you want regular unix syslog files, you can configure syslogd
  881. in /etc/syslog.conf.  Here's the one that I use:
  882.  
  883. #
  884. # See the supplied /etc/syslog.conf file for copious comments.
  885. #
  886. *.err;kern.debug;auth.notice;user.none          /dev/console
  887. *.err;kern.debug;daemon,auth.notice;mail.crit;user.none /var/adm/messages
  888. lpr.debug                                       /var/adm/lpd-errs
  889.  
  890. *.alert;kern.err;daemon.err;user.none           operator
  891. *.alert;user.none                               root
  892.  
  893. *.emerg;user.none                               *
  894.  
  895. # for loghost machines, to have authentication messages (su, login, etc.)
  896. # logged to a file, un-comment out the following line and adjust the 
  897. # file name as appropriate.
  898. #
  899. # if a non-loghost machine chooses to have such messages 
  900. # sent to the loghost machine, un-comment out the following line.
  901. #
  902. auth.notice                     /var/log/authlog
  903.  
  904. mail.debug                      /var/log/syslog
  905.  
  906. # following line for compatibility with old sendmails.  they will send
  907. # messages with no facility code, which will be turned into "user" messages
  908. # by the local syslog daemon.  only the "loghost" machine needs the following
  909. # line, to cause these old sendmail log messages to be logged in the
  910. # mail syslog file.
  911. #
  912. user.alert                       /var/log/syslog
  913. #
  914. # non-loghost machines will use the following lines to cause "user"
  915. # log messages to be logged locally.
  916. #
  917. user.err                         /dev/console
  918. user.err                         /var/adm/messages
  919. user.alert                       `root, operator'
  920. user.emerg                       *
  921.  
  922.  
  923. 1.116: How can I log information about ftp accesses to a file?
  924. From: elr@trintex.uucp (Ed Ravin) and
  925.       map@hal.maths.monash.edu.au (Michael Page)
  926.  
  927. 1) In /etc/syslog.conf, add the line:
  928.    daemon.debug        /tmp/daemon.log
  929.  
  930. 2) # touch  /tmp/daemon.log
  931.    # refresh -s syslogd
  932.  
  933. 3) Modify your inetd.conf so that ftpd is called with the "-l" flag.
  934.    You may also want the "-d" flag.  This can be done with 'smit inetdconf'. 
  935.  
  936. All the syslog messages from various system daemons should now appear in
  937. the file "/tmp/daemon.log".
  938.  
  939.  
  940. 1.117: How do I find a file name from the inode number?
  941. From: svpillay@berlioz.crs4.it (Kanthan Pillay)
  942.  
  943.       find /mntpoint -xdev -inum nnnn -print
  944.  
  945.  
  946. 1.118: How do I set up postscript accounting?
  947. From: taluskie@utpapa.ph.utexas.edu (Vince Taluskie)
  948.  
  949. The following program to configure postscript page accounting was 
  950. originally written by Ephraim Vider.  It acts as a backend wrapper 
  951. which logs accounting information in /etc/qconfig. It can be ftp'd 
  952. from utpapa.ph.utexas.edu in /pub/aix/psacct.tar.Z.
  953.  
  954. To get this program running compile it with
  955.  
  956. cc  pswrap.c -o pswrap -lqb
  957.  
  958. and then make this program suid root with
  959.  
  960. chown root pswrap
  961. chmod u+s pswrap
  962.  
  963. If this step is not done, the printer will hang.
  964.  
  965. Then start up SMIT and go to :
  966.  
  967. Spooler
  968.   Manage Local Printer Subsystem
  969.     Local Printer Queue Devices
  970.       Change / Show Characteristics of a Queue Device
  971.         <Select Queue>
  972.           <Select Device>
  973.  
  974. and change "BACKEND PROGRAM pathname" to the full pathname of pswrap
  975. since pswrap will now handle the backend interface with the queue.
  976.  
  977. A stream of info will be written to a logfile in /tmp (prob lp0.log)
  978. but this file is mainly used for status info and raw pagecounts.  If 
  979. the accounting data is going to the qconfig-specified acctfile, then
  980. use the 'pac' command to read it.  I prefer to have readable ascii data
  981. files instead, so just I comment out the '#define WANT_PAC' line and it
  982. will only go to the ACCTFILE specfied in pswrap.c.
  983.  
  984.  
  985. /*********    pswrap.c    ***********/
  986.  
  987. /*
  988.  compile with:   cc pswrap.c -o pswrap -lqb
  989.  (for doc on the qb library see "understanding backend routines in libqb")
  990.  
  991.  BTW:  The log_charge() function doesn't seem to do anything,
  992.        but log_pages() updates the accounting info.
  993.  
  994. Ephraim Vider, original author 
  995.  
  996. --
  997. Feb 10, 1993
  998.  
  999. You can set pswrap up to use either the accounting file specified in
  1000. /etc/qconfig (which means that you need to get your data from 'pac')
  1001. or you can comment out the #define WANT_PAC line and then the accounting
  1002. data will only go into the ACCTFILE.
  1003.  
  1004. Also modified the logging to the ASCII acctfile so that it looks more
  1005. readable.
  1006.  
  1007. Vince Taluskie
  1008. */
  1009.  
  1010.  #include <stdio.h>
  1011.  #include <string.h>
  1012.  #include <ctype.h>
  1013.  #include <fcntl.h>
  1014.  #include <signal.h>
  1015.  #include <setjmp.h>
  1016.  #include <sys/wait.h>
  1017.  #include <IN/backend.h>
  1018.  #include <IN/standard.h>
  1019.  #include "qprocs.h"
  1020.  
  1021.  char     *nextword (char *p);
  1022.  char     *skipvalue (char *p);
  1023.  
  1024.  #define LOGDIR     "/tmp"
  1025.  #define ACCTFILE   "/usr/adm/acct/lpr/ps-acct"
  1026. /* #define WANT_PAC     1 */     /* this define will also send accounting
  1027.                                  info to the acctfile specified in
  1028.                  /etc/qconfig file.  If this define is 
  1029.                  commented out then accounting info will
  1030.                  only go to ACCTFILE  */
  1031.  
  1032.  
  1033.  char     pcprog[] = "statusdict begin pagecount = end\n\x04";
  1034.  
  1035.  char     *keyw[] = {
  1036.      "idle",
  1037.      "busy",
  1038.      "waiting",
  1039.      "printing",
  1040.      "initializing",
  1041.      NULL
  1042.  };
  1043.  enum     { PS_IDLE, PS_BUSY, PS_WAIT, PS_PRINT, PS_INIT, PS_UNKNOWN };
  1044.  
  1045.  void     giveup();
  1046.  jmp_buf  jumper;
  1047.  
  1048.  char     logfname[30];
  1049.  FILE     *logfile, *acctfile;
  1050.  
  1051.  main (argc, argv)
  1052.  int argc;
  1053.  char     *argv[];
  1054.  {
  1055.      char *devname;
  1056.      int  pagcnt, c;
  1057.      int  pid;
  1058.      int  w, status;
  1059.  
  1060.      if (argc < 2) {
  1061.           fprintf(stderr, "Usage: psbe file\n");
  1062.           exit(-1);
  1063.      }
  1064.      if (log_init(argv[1]) < 0) {
  1065.           fprintf(stderr, "log_init failed!\n");
  1066.           exit(EXITBAD);
  1067.      }
  1068.      sprintf(logfname, "%s/%s.log", LOGDIR, get_device_name());
  1069.      if ((logfile = fopen(logfname, "a")) == NULL) {
  1070.           fprintf(stderr, "Can't open logfile.\n");
  1071.           exit(EXITBAD);
  1072.      }
  1073.  
  1074.      if ((acctfile = fopen(ACCTFILE, "a")) == NULL) {
  1075.      fprintf(stderr, "Can't open logfile.\n");
  1076.      exit(EXITBAD);
  1077.      }
  1078.  
  1079.      setvbuf(logfile, NULL, _IOLBF, BUFSIZ);
  1080.      setvbuf(acctfile, NULL, _IOLBF, BUFSIZ);
  1081.  
  1082.      setvbuf(stdin, NULL, _IONBF, 0);
  1083.      setvbuf(stdout, NULL, _IONBF, 0);
  1084.      fprintf(logfile, "start Job no. %d, queued on %s\n", get_job_number(),
  1085.                get_qdate());
  1086.      log_status(WAITING);
  1087.      pagcnt = getpagecnt();
  1088.      log_status(RUNNING);
  1089.      if ((pid = fork()) < 0) {
  1090.           perror("fork");
  1091.           exit(EXITBAD);
  1092.      }
  1093.      if (pid == 0) {
  1094.           argv[0] = "piobe";
  1095.           execv("/usr/lpd/piobe", argv);
  1096.           perror("exec");
  1097.           exit(EXITBAD);
  1098.      }
  1099.      while ((w = wait(&status)) != pid)
  1100.           if (w == -1) {
  1101.                perror("wait");
  1102.                exit(EXITBAD);
  1103.           }
  1104.      if (WEXITSTATUS(status) != 0)
  1105.           exit(WEXITSTATUS(status));
  1106.      log_status(WAITING);
  1107.  
  1108.      if (pagcnt > 0 && (c = getpagecnt()) > 0) {
  1109. #ifdef WANT_PAC 
  1110.           log_pages(c - pagcnt);
  1111. #endif
  1112.     }
  1113.  
  1114.      fprintf(logfile, "end Job no. %d, queued on %s\n", get_job_number(),
  1115.                get_qdate());
  1116.  
  1117. /* the accounting file format is 
  1118.  
  1119. pages_printed     user     queue_printed_on   time_queued
  1120.  
  1121. */
  1122.  
  1123.      fprintf(acctfile, "%d %35s %7s    %s \n", (c - pagcnt), get_from(), get_queue_name(), get_qdate());
  1124.  
  1125.      fclose(logfile);
  1126.      fclose(acctfile);
  1127.      exit(EXITOK);
  1128.  }
  1129.  
  1130.  void     giveup ()
  1131.  {
  1132.      longjmp(jumper, 1);
  1133.  }
  1134.  
  1135.  getpagecnt ()
  1136.  {
  1137.      int  pc = 0, pstat;
  1138.      char buf[81];
  1139.  
  1140.      if (setjmp(jumper) != 0) {
  1141.           fprintf(logfile, "giving up on status\n");
  1142.           return (0);
  1143.      }
  1144.      alarm(60 * 2);
  1145.      signal(SIGALRM, giveup);
  1146.      do {
  1147.           if (!gets(buf)) {
  1148.                sleep(5);
  1149.                putchar('\x14');    /* ^T returns status */
  1150.                sleep(1); /* wait for answer from printer */
  1151.                if (!gets(buf))
  1152.                     return (0);
  1153.           }
  1154.           fprintf(logfile, "%s\n", buf);
  1155.           if ((pstat = getstatus(buf)) == PS_WAIT) {
  1156.                putchar('\x04');
  1157.                sleep(1);
  1158.           }
  1159.      } while (pstat != PS_IDLE);
  1160.      alarm(0);
  1161.      while (gets(buf))
  1162.           fprintf(logfile, "%s\n", buf);
  1163.      printf("%s", pcprog);
  1164.      sleep(1); /* wait for answer from printer */
  1165.      if (!gets(buf))
  1166.           return (0);
  1167.      if (sscanf(buf, "%d", &pc) != 1)
  1168.           return (0);
  1169.      fprintf(logfile, "%d\n", pc);
  1170.      return (pc);
  1171.  }
  1172.  
  1173.  /*
  1174.   * Parser for printer status messages
  1175.   */
  1176.  
  1177.  getstatus (p)
  1178.  char     *p;
  1179.  {
  1180.      char *t;
  1181.      int  i;
  1182.  
  1183.      if ((p = strchr(p, '%')) == NULL)
  1184.           return (PS_UNKNOWN);
  1185.      if (strncmp(p, "%%[", 3) != 0)
  1186.           return (PS_UNKNOWN);
  1187.      for (p = nextword(p + 3) ; p != NULL ; p = skipvalue(p)) {
  1188.           t = p;
  1189.           p = strchr(p, ':');
  1190.           *p++ = '\0';
  1191.           p = nextword(p);
  1192.           if (strcmp(t, "status") == 0)
  1193.                break;
  1194.      }
  1195.      if (p == NULL)
  1196.           return (PS_UNKNOWN);
  1197.      t = p;
  1198.      p = strchr(p, ' ');
  1199.      if (p[-1] == ';')
  1200.           p--;
  1201.      *p = '\0';
  1202.      for (i = 0 ; keyw[i] != NULL ; i++)
  1203.           if (strcmp(t, keyw[i]) == 0)
  1204.                break;
  1205.      return (i);
  1206.  }
  1207.  
  1208.  char     *nextword (p)
  1209.  char     *p;
  1210.  {
  1211.      while (isspace(*p))
  1212.           p++;
  1213.      if (strncmp(p, "]%%", 3) == 0)
  1214.           return (NULL);
  1215.      return (p);
  1216.  }
  1217.  
  1218.  char     *skipvalue (p)
  1219.  char     *p;
  1220.  {
  1221.      char *t;
  1222.  
  1223.      while (p != NULL) {
  1224.           p = strchr(p, ' ');
  1225.           t = p;
  1226.           p = nextword(p);
  1227.           if (t[-1] == ';')
  1228.                break;
  1229.      }
  1230.      return (p);
  1231.  }
  1232.  
  1233.  /*********    qprocs.h    ***********/
  1234.  /* functions for communication between qdaemon and the backend */
  1235.  
  1236.  char     *get_from();
  1237.  char     *get_to();
  1238.  char     *get_qdate();
  1239.  char     *get_queue_name();
  1240.  char     *get_device_name();
  1241.  char     *get_title();
  1242.  
  1243.  
  1244. 1.119: How do I create boot diskettes for 3.2?
  1245.  
  1246. You need to have four formatted diskettes.
  1247.  
  1248. boot disk:                bosboot -d /dev/fd0 -a
  1249. display disk:             mkdispdskt
  1250. display extension disk:   mkextdskt
  1251. Install/Maintenance disk: mkinstdskt
  1252.  
  1253.  
  1254. 1.120: Where can I find tools for performance monitoring?
  1255.  
  1256. For 3.2 a few tools are available in /usr/lpp/bosperf.  There are tools
  1257. to monitor traces, I/O events, CPU, virtual memory, disk block usage,
  1258. kernel extensions, etc. It even has a simulator, rmss, that allows one
  1259. to try out different memory size configurations to see how it impacts
  1260. performance.  See 6.05 for the AIX Performance and Tuning Guide.
  1261.  
  1262.  
  1263. 1.121: How can I tell what virtual printer a print queue is using?
  1264. From: yoder@austin.ibm.com (Stuart R. Yoder)
  1265.  
  1266. Use the command 'lsvirprt'.  Don't use any parameters and it will
  1267. run in an interactive mode that will give you a menu of all virtual
  1268. printers on the system with the queue and device for each one.
  1269.  
  1270.  
  1271. 1.122: Two srcmstr's are less useful than one?
  1272. From: hubert@rs530.ncs.mainz.ibm.com (Bernhard Zeller)
  1273.  
  1274. This can happen on systems that have no console, or systems with an
  1275. async terminal as the console but not attached or turned off.  One of the
  1276. symptoms is a second srcmstr got run.  But the second srcmstr is worthless
  1277. as we can't use the stop/startsrc commands, refresh inetd, qdaemon won't
  1278. start, etc.  
  1279.  
  1280. To resolve this, type:
  1281.  
  1282.     smit chgtty
  1283.  
  1284. and add the keyword 'clocal' in following lines:
  1285.  
  1286.    STTY attributes for RUN TIME
  1287.    STTY attributes for LOGIN
  1288.  
  1289.  
  1290. 1.123: How do I set the tty name associated with a physical port?
  1291. From: accapadi@mathew.austin.ibm.com (Matt Accapadi)
  1292.  
  1293. Let's say you wanted to make a tty on the s1 port and call it rs0000
  1294. and a tty on the s2 port and call it rs0001.
  1295.  
  1296. You could run:
  1297.  
  1298. mkdev -c tty -s rs232 -t tty -l rs0000 -p sa0 -w s1   # creates rs0000
  1299. and
  1300. mkdev -c tty -s rs232 -t tty -l rs0001 -p sa1 -w s2   # creates rs0001
  1301.  
  1302.  
  1303. 1.124: How do I use mksysb to clone a system?
  1304. From: joann@ariadne.SLAC.Stanford.EDU (Jo Ann Malina)
  1305.  
  1306. I use the following steps on the master machine to clone an AIX system:
  1307. 1) Remove the password from root.
  1308. 2) Remove the NIS line from the end of the /etc/group file (the last
  1309.    line with the +: )
  1310. 3) Change most of the level '2' designations in /etc/inittab to level
  1311.    '3' to prevent them from being started up when the new system is
  1312.    booted (the minimum ones to change are rc.nfs and rc.tcpip)
  1313. 4) Boot in service mode and change the name and ip address to a "spare"
  1314.    set to avoid address collision.
  1315. 5) Clear /tmp, /usr/tmp and /usr/spool/lpd/stat.
  1316. 6) Run mkszfile and edit it to be sure /usr is as small as possible;
  1317.    then mksysb from the command line.
  1318.  
  1319. The above changes allow me to boot in normal mode the first time, get in
  1320. as root, change the above files back and do the other things necessary
  1321. to configure the new system.
  1322.  
  1323. Then, of course, I go back and clean up and reboot my master machine.
  1324.  
  1325. Note: 1 and 2 lets you log in even if you can't get on the network. 
  1326.    It prevents the login process from trying to reach an NIS server. 
  1327.    Step 2 needed only if you use NIS.
  1328.  
  1329.  
  1330. 1.125: How do I retain timestamps with mksysb?
  1331. From: graeme@ccu1.aukuni.ac.nz ( Graeme Moffat)
  1332.  
  1333. In /usr/lpp/bosinst/bosnet (for net installs), and bosrest (tape), the
  1334. 'pax' commands all have '-pmop' options.  m = "DON'T retain modification
  1335. times".  So, simply change all the '-pmop' to '-pop' and remake
  1336. inst/maint diskettes or mksysb tapes.
  1337.  
  1338.  
  1339. 1.126: How can I find out the machine type?
  1340. From: umar@compsci.cas.vanderbilt.edu (Sait Umar)
  1341.  
  1342. #!/bin/sh
  1343. #
  1344. #  Author G. Vitillaro              (peppe@ipgaix.unipg.it)
  1345. #  from an idea of Marc Pawliger    (marc@ibmpa.awdpa.ibm.com)
  1346. #
  1347. #  10/12/92  GVT  First (and last) implementation
  1348. #
  1349. # machine : will get machine type on RISC/6000
  1350. #
  1351. #
  1352. awk '
  1353.         BEGIN {
  1354.                 m["10"]="7013/530 or 7016/730";
  1355.                 m["11"]="7013/540";
  1356.                 m["14"]="7013/540";
  1357.                 m["18"]="7013/530H";
  1358.                 m["1C"]="7013/550";
  1359.                 m["20"]="7015/930";
  1360.                 m["2E"]="7015/950";
  1361.                 m["2E"]="7015/950E";
  1362.                 m["30"]="7013/520";
  1363.                 m["31"]="7012/320";
  1364.                 m["34"]="7013/520H";
  1365.                 m["35"]="7012/320H or 320E";
  1366.                 m["37"]="7012/340";
  1367.                 m["38"]="7012/350";
  1368.                 m["41"]="7011/220";
  1369.                 m["45"]="7011/M20";
  1370.                 m["5C"]="7013/560";
  1371.                 m["63"]="7015/970";
  1372.                 m["64"]="7015/980";
  1373.                 m["66"]="7015/580";
  1374.                 m["67"]="7015/570";
  1375.                 m["75"]="7012/370, 375, or 37T";
  1376.                 m["76"]="7012/360, 365, or 36T";
  1377.                 m["77"]="7012/350, 355, or 7013/550L";
  1378.                 m["78"]="7012/315 or 7013/510 ";
  1379.                 if ( m[code] != "" )
  1380.                         print "This RISC/6000 is a " m[code];
  1381.                 else
  1382.                         print "Unknown Machine";
  1383.         }
  1384. ' code=`uname -m | cut -c9-10` < /dev/null
  1385.  
  1386.  
  1387.