allanswers.org - comp.unix.aix Frequently Asked Questions (Part 5 of 5)

 Home >  Computers and Hardwareaix-faq >

comp.unix.aix Frequently Asked Questions (Part 5 of 5)

Section 1 of 2 - Prev - Next


Posted-By: auto-faq 3.3 (Perl 5.005)
Archive-name: aix-faq/part5
Revision: 1.14 2000/01/04 02:34:26
Posting-Frequency: monthly

------------------------------

Subject: 6.05  What publications are available for AIX and RS/6000?


  Publications list:
  http://www.rs6000.ibm.com/resource/aix_resource/Pubs/

  AIXpert magazine: http://www.developer.ibm.com/library/aixpert/

AIXpert
   IBM Corporation
   Mail Stop 36
   472 Wheelers Farms Road
   Milford, CT 06460
   FAX: (203) 783-7669

These manuals should be available from your favorite IBM office.
 
SC23-2204-02  Problem Solving Guide
SC23-2365-01  Performance Monitoring and Tuning Guide for AIX 3.2
SA23-2629-07  Service Request Number Cross Reference, Ver 2.2
SA23-2631-05  Diagnostic Programs: Operator Guide
SA23-2632-05  Diagnostic Programs: Service Guide
SA23-2643-01  Hardware Technical Reference: General Information
SA23-2646-01  Hardware Technical Reference: Options and Devices

IBM's International Technical Support Center produces redbooks -
practical, how-to manuals - on a wide range of technical topics
including AIX migration, system management, internet security, and
RS/6000 hardware.  Abstracts and ordering information areavailable
from the redbooks homepage .  (See Question
6.09 also.)

Computer bookstores often carry many of the following:

"Power RISC System/6000: Concepts, Facilities, Architecture", Chakravarty  
         McGraw-Hill ISBN 0070110476
"PowerPC: Concepts, Facilities, Architecture", Chakravarty/Cannon  
         McGraw-Hill ISBN 0070111928
"The Advanced Programmer's Guide to AIX 3.x", Colledge 
         McGraw-Hill ISBN 007707663X
"AIX Companion" , Cohn    
         Prentice-Hall ISBN 0132912201
"AIX for RS/6000: System & Administration Guide", DeRoest 
         McGraw-Hill ISBN 0070364397
"A Guide to AIX 3.2", Franklin
         Metro-Info Systems 05/1993
"IBM RS6000 AIX System Administration", Hollicker
         Prentice-Hall ISBN 0134526163
"IBM RISC SYSTEM/6000 - A Business Perspective", Hoskins
         John Wiley & Sons ISBN 0471599352
"The Advanced Programmer's Guide to AIX 3.x", Phil Colledge
	McGraw-Hill, 1994, ISBN: 0-07-707663-x
"AIX Performance Tuning", Frank Waters
	 Prentice-Hall 1996 ISBN 0-13-386707-2
"The AIX Survival Guide", Andreas Siegert
	Addison-Wesley 1996 ISBN 1-201-59388-2

------------------------------

Subject: 6.06: Some acronyms

APAR   - Authorized Program Analysis Report
	 Created internaly by a systems programmer to solve a code bug.
BOS    - Base Operating System
DCR    - design change request
	 Someone asked to change something.
LPP    - Licensed Program Product
ODM    - Object Data Manager
 	 Don't touch until you grok it.
PRPQ   - programming request for price quotation
	 Essentialy, a program that is not available off-the-shelf. 
	 (e.g. HACMP started as a PRPQ, you could not order HACMP, but
	 you could ask IBM for a highly-available solution)
PTF    - Program Temporary Fix
	 Temporary ?  Yes!  Read "The Tao of Computing".
SMIT   - System Management Interface Tool
SMITTY - SMIT, tty interface, no bells, no whistles. "alias smit=smitty"
Y2K    - Done.  Total non-event.

------------------------------

Subject: 6.07: How do I get this by mailserver or ftp?

Since the articles are crossposted to news.answers, any archive
carrying that newsgroup will also have these articles.  In particular,
try ftp'ing to rtfm.mit.edu and checking the directory
pub/usenet/news.answers. This FAQ is archived as "aix-faq/part[12345]".

The FAQ is also availible via email using the address
mail-server@rtfm.MIT.edu two examples of how you might use this from a
UNIX prompt follow:

echo help | mail mail-server@rtfm.MIT.edu
echo send usenet/news.answers/aix-faq/part1 | mail mail-server@rtfm.MIT.edu

------------------------------

Subject: 6.08: Hypertext version of the FAQ

United States:
  
  
New Zealand:
  
France:
  
Canada:
  

------------------------------

Subject: 6.09: IBM AIX documentation on the WWW.

 contains links to IBM
documentation, this includes links to the redbooks site (how to
documents) as well as links to the AIX 4.3 manuals.


------------------------------

Subject: 6.10: Comp.unix.aix archive availible on the WWW

Michael Staats & Fred Hucht have informed me that a searchable archive of
comp.unix.aix is availible at: 
.

------------------------------

Subject: 6.11: How can I access the comp.unix.aix newsgroup
               via email (or Web)?
From: Ciaran Deignan  

It is possible to get "digests" of the AIX newsgroup by email. Each
digest contains a summary (just the subject lines from each post)
plus the contents of a series of news articles posted to the newsgroup.
Each digest is about 800 lines long, and the newsgroup typically generates
5 digest mails per day.

To get these digests, you have to subscribe to a mailing list. Send
an email to the address majordomo@dmshome.youngstown.oh.us, and put
the text "subscribe aix-digest" in the body of the message.

[Editor's note: The above address does not appear to work any longer, if
anyone knows of a functional equivalent please drop me a note.]

It is equally possible to post articles to the newsgroup via email.
Any mail sent to the address aixnews@cc.ysu.edu will be forwarded to
the comp.unix.aix newsgroup.

These services are provided by Doug Sewell .

Comp.unix.aix can be accessed from the web via http://www.deja.com/

------------------------------


Subject: 8.03: How do I set up postscript accounting?

[ formerly in section 1.118 ]

/*  pswrap.c

 compile with:   cc pswrap.c -o pswrap -lqb
 (for doc on the qb library see "understanding backend routines in libqb")

 BTW:  The log_charge() function doesn't seem to do anything,
       but log_pages() updates the accounting info.

Ephraim Vider, original author 

--
Feb 10, 1993

You can set pswrap up to use either the accounting file specified in
/etc/qconfig (which means that you need to get your data from 'pac') or
you can comment out the #define WANT_PAC line and then the accounting
data will only go into the ACCTFILE.

Also modified the logging to the ASCII acctfile so that it looks more
readable.

Vince Taluskie
*/

 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include "qprocs.h"
 
 char     *nextword (char *p);
 char     *skipvalue (char *p);
 
 #define LOGDIR     "/tmp"
 #define ACCTFILE   "/usr/adm/acct/lpr/ps-acct"
/* #define WANT_PAC 	1 */     /* this define will also send accounting
                                 info to the acctfile specified in
				 /etc/qconfig file.  If this define is 
				 commented out then accounting info will
				 only go to ACCTFILE  */
 

 char     pcprog[] = "statusdict begin pagecount = end\n\x04";
 
 char     *keyw[] = {
     "idle",
     "busy",
     "waiting",
     "printing",
     "initializing",
     NULL
 };
 enum     { PS_IDLE, PS_BUSY, PS_WAIT, PS_PRINT, PS_INIT, PS_UNKNOWN };
 
 void     giveup();
 jmp_buf  jumper;
 
 char     logfname[30];
 FILE     *logfile, *acctfile;
 
 main (argc, argv)
 int argc;
 char     *argv[];
 {
     char *devname;
     int  pagcnt, c;
     int  pid;
     int  w, status;
 
     if (argc < 2) {
          fprintf(stderr, "Usage: psbe file\n");
          exit(-1);
     }
     if (log_init(argv[1]) < 0) {
          fprintf(stderr, "log_init failed!\n");
          exit(EXITBAD);
     }
     sprintf(logfname, "%s/%s.log", LOGDIR, get_device_name());
     if ((logfile = fopen(logfname, "a")) == NULL) {
          fprintf(stderr, "Can't open logfile.\n");
          exit(EXITBAD);
     }

     if ((acctfile = fopen(ACCTFILE, "a")) == NULL) {
	 fprintf(stderr, "Can't open logfile.\n");
	 exit(EXITBAD);
	 }

     setvbuf(logfile, NULL, _IOLBF, BUFSIZ);
     setvbuf(acctfile, NULL, _IOLBF, BUFSIZ);

     setvbuf(stdin, NULL, _IONBF, 0);
     setvbuf(stdout, NULL, _IONBF, 0);
     fprintf(logfile, "start Job no. %d, queued on %s\n", get_job_number(),
               get_qdate());
     log_status(WAITING);
     pagcnt = getpagecnt();
     log_status(RUNNING);
     if ((pid = fork()) < 0) {
          perror("fork");
          exit(EXITBAD);
     }
     if (pid == 0) {
          argv[0] = "piobe";
          execv("/usr/lpd/piobe", argv);
          perror("exec");
          exit(EXITBAD);
     }
     while ((w = wait(&status)) != pid)
          if (w == -1) {
               perror("wait");
               exit(EXITBAD);
          }
     if (WEXITSTATUS(status) != 0)
          exit(WEXITSTATUS(status));
     log_status(WAITING);

     if (pagcnt > 0 && (c = getpagecnt()) > 0) {
#ifdef WANT_PAC 
          log_pages(c - pagcnt);
#endif
	}

     fprintf(logfile, "end Job no. %d, queued on %s\n", get_job_number(),
               get_qdate());

/* the accounting file format is 

pages_printed     user     queue_printed_on   time_queued

*/

     fprintf(acctfile, "%d %35s %7s    %s \n", (c - pagcnt), get_from(), get_queue_name(), get_qdate());

     fclose(logfile);
     fclose(acctfile);
     exit(EXITOK);
 }
 
 void     giveup ()
 {
     longjmp(jumper, 1);
 }
 
 getpagecnt ()
 {
     int  pc = 0, pstat;
     char buf[81];
 
     if (setjmp(jumper) != 0) {
          fprintf(logfile, "giving up on status\n");
          return (0);
     }
     alarm(60 * 2);
     signal(SIGALRM, giveup);
     do {
          if (!gets(buf)) {
               sleep(5);
               putchar('\x14');    /* ^T returns status */
               sleep(1); /* wait for answer from printer */
               if (!gets(buf))
                    return (0);
          }
          fprintf(logfile, "%s\n", buf);
          if ((pstat = getstatus(buf)) == PS_WAIT) {
               putchar('\x04');
               sleep(1);
          }
     } while (pstat != PS_IDLE);
     alarm(0);
     while (gets(buf))
          fprintf(logfile, "%s\n", buf);
     printf("%s", pcprog);
     sleep(1); /* wait for answer from printer */
     if (!gets(buf))
          return (0);
     if (sscanf(buf, "%d", &pc) != 1)
          return (0);
     fprintf(logfile, "%d\n", pc);
     return (pc);
 }
 
 /*
  * Parser for printer status messages
  */
 
 getstatus (p)
 char     *p;
 {
     char *t;
     int  i;
 
     if ((p = strchr(p, '%')) == NULL)
          return (PS_UNKNOWN);
     if (strncmp(p, "%%[", 3) != 0)
          return (PS_UNKNOWN);
     for (p = nextword(p + 3) ; p != NULL ; p = skipvalue(p)) {
          t = p;
          p = strchr(p, ':');
          *p++ = '\0';
          p = nextword(p);
          if (strcmp(t, "status") == 0)
               break;
     }
     if (p == NULL)
          return (PS_UNKNOWN);
     t = p;
     p = strchr(p, ' ');
     if (p[-1] == ';')
          p--;
     *p = '\0';
     for (i = 0 ; keyw[i] != NULL ; i++)
          if (strcmp(t, keyw[i]) == 0)
               break;
     return (i);
 }
 
 char     *nextword (p)
 char     *p;
 {
     while (isspace(*p))
          p++;
     if (strncmp(p, "]%%", 3) == 0)
          return (NULL);
     return (p);
 }
 
 char     *skipvalue (p)
 char     *p;
 {
     char *t;
 
     while (p != NULL) {
          p = strchr(p, ' ');
          t = p;
          p = nextword(p);
          if (t[-1] == ';')
               break;
     }
     return (p);
 }

 /*********    qprocs.h    ***********/
 /* functions for communication between qdaemon and the backend */
 
 char     *get_from();
 char     *get_to();
 char     *get_qdate();
 char     *get_queue_name();
 char     *get_device_name();
 char     *get_title();


------------------------------

Subject: 8.04: How can I find out the machine type?
From: anonymous

[ formerly in section 1.126 ]

#!/bin/ksh
# Determine machine type
# Jim O'Quinn  2/28/93
# AIX Software Support
# This does not represent my employer, use at own risk.....
# Changed to report newer machines and unknown ids. /Fred
# More new machines. /David

MachType=`uname -m | cut -c9-10`
case $MachType
in
  02)  nMachType="7015/930";;
  10)  nMachType="7013/530 or 7016/720 or 7016/730";;
  11|14)  nMachType="7013/540";;
  18)  nMachType="7013/53H";;
  1C)  nMachType="7013/550";;
  20)  nMachType="7015/930";;
  2E)  nMachType="7015/950 or 7015/950E";;
  30)  nMachType="7013/520 or 7018/740 or 7018/741";;
  31)  nMachType="7012/320";;
  34)  nMachType="7013/52H";;
  35)  nMachType="7012/32H or 7012/320E";;
  37)  nMachType="7012/340 or 7012/34H";;
  38)  nMachType="7012/350";;
  41)  nMachType="7011/220 or 7011/22W or 7011/22G or 7011/230";;
  42)  nMachType="7006/41T or 7006/41W";;
  43)  nMachType="7008/M20";;
  45)  nMachType="7011/220 or 7011/M20 or 7011/230 or 7011/23W";;
  46)  nMachType="7011/250";;
  47)  nMachType="7011/230";;
  48)  nMachType="7009/C10";;
  49)  nMachType="7011/250";;
  4C)  nMachType="604/43P";;
  4D)  nMachType="601/40P";;
  57)  nMachType="7012/390 or 7012/3BT or 7030/3BT or 7032/3AT or 7011/390";;
  58)  nMachType="7012/380 or 7012/3AT or 7030/3BT";;
  59)  nMachType="3CT or 39H";;
  5C)  nMachType="7013/560";;
  63)  nMachType="7015/970 or 7015/97B";;
  64)  nMachType="7015/980 or 7015/98B";;
  66)  nMachType="7013/580 or 7013/58F or 7015/580";;
  67)  nMachType="7013/570 or 7013/770 or 7013/771 or 7013/R10 or 7015/570";;
  70)  nMachType="7013/590";;
  71)  nMachType="7013/58H";;
  72)  nMachType="7013/59H or 7013/R12 or 7013/58H";;
  75)  nMachType="7012/370 or 7012/375 or 7012/37T";;
  76)  nMachType="7012/360 or 7012/365 or 7012/36T";;
  77)  nMachType="7012/315 or 7012/350 or 7012/355 or 7012/510 or 7012/55H or 7012/55L";;
  78)  nMachType="7012/315 or 7013/510";;
  79)  nMachType="7013/590";;
  80)  nMachType="7015/990";;
  82)  nMachType="7015/R00 or 7015/R24";;
  90)  nMachType="IBM C20";;
  91)  nMachType="604/42T";;
  A0)  nMachType="7013/J30 or 7013/R30";;
  A3)  nMachType="7013/R30";;
  A6)  nMachType="7012/G30";;
  C4)  nMachType="F40";;
  E0)  nMachType="603/MOTOROLA PowerStack";;
  *)  nMachType="Unknown($MachType)"
esac
echo "Machine type: "$nMachType"

From: Jan Just Keijser  

I've attached a C program which determines the model and the amount of
memory installed in C code (by querying the ODM directly). It can be
compiled using
  cc -o model model.c -lcfg -lodm

#include 
#include 
#include 

#include 
#include 
#include 
#include 

void main (void)
{
  struct utsname	name;
  int			memsize;

  char         s[3];
  int          model;

  struct CuAt *odm_obj;
  int          how_many;

  uname(&name);

  printf( "sysname  = %s\n", name.sysname );
  printf( "nodename = %s\n", name.nodename );
  printf( "release  = %s\n", name.release );
  printf( "version  = %s\n", name.version );
  printf( "machine  = %s\n", name.machine );

  printf( "model    = " );
   /* On AIX, the model is encoded in the last 2 non-zero digits
      of the model code (uname -m)
   */
   s[0] = name.machine[ strlen( name.machine ) - 4 ];
   s[1] = name.machine[ strlen( name.machine ) - 3 ];
   s[2] = '\0';
   model = strtol(s, NULL, 16);
  
   switch (model)
   {
      case 0x10:  puts ( "Model 530/730" );
                  break;
      case 0x11:
      case 0x14:  puts ( "Model 540" );
                  break;
      case 0x18:  puts ( "Model 530H" );
                  break;
      case 0x1C:  puts ( "Model 550" );
                  break;
      case 0x20:  puts ( "Model 930" );
                  break;
      case 0x2E:  puts ( "Model 950/950E" );
                  break;
      case 0x30:  puts ( "Model 520 or 740/741" );
                  break;
      case 0x31:  puts ( "Model 320" );
                  break;
      case 0x34:  puts ( "Model 520H" );
                  break;
      case 0x35:  puts ( "Model 32H/320E" );
                  break;
      case 0x37:  puts ( "Model 340/34H" );
                  break;
      case 0x38:  puts ( "Model 350" );
                  break;
      case 0x41:  puts ( "Model 220/22W/22G/230" );
                  break;
      case 0x42:  puts ( "Model 41T/41W" );
                  break;
      case 0x43:  puts ( "Model M20" );
                  break;
      case 0x45:  puts ( "Model 220/M20/230/23W" );
                  break;
      case 0x46:
      case 0x49:  puts ( "Model 250" );
                  break;
      case 0x47:  puts ( "Model 230" );
                  break;
      case 0x48:  puts ( "Model C10" );
                  break;
      case 0x4C:  puts ( "PowerPC 603/604 model" );
                  break;
      case 0x4D:  puts ( "Model 40P" );
                  break;
      case 0x57:  puts ( "Model 390/3AT/3BT" );
                  break;
      case 0x58:  puts ( "Model 380/3AT/3BT" );
                  break;
      case 0x59:  puts ( "Model 39H/3CT" );
                  break;
      case 0x5C:  puts ( "Model 560" );
                  break;
      case 0x63:  puts ( "Model 970/97B" );
                  break;
      case 0x64:  puts ( "Model 980/98B" );
                  break;
      case 0x66:  puts ( "Model 580/58F" );
                  break;
      case 0x67:  puts ( "Model 570/770/R10" );
                  break;
      case 0x70:  puts ( "Model 590" );
                  break;
      case 0x71:  puts ( "Model 58H" );
                  break;
      case 0x72:  puts ( "Model 59H/58H/R12/R20" );
                  break;
      case 0x75:  puts ( "Model 370/375/37T" );
                  break;
      case 0x76:  puts ( "Model 360/365/36T" );
                  break;
      case 0x77:  puts ( "Model 315/350/355/510/550H/550L" );
                  break;
      case 0x79:  puts ( "Model 591" );
                  break;
      case 0x80:  puts ( "Model 990" );
                  break;
      case 0x81:  puts ( "Model R24" );
                  break;
      case 0x82:  puts ( "Model R00/R24" );
                  break;
      case 0x89:  puts ( "Model 595" );
                  break;
      case 0x90:  puts ( "Model C20" );
                  break;
      case 0x91:  puts ( "Model 42T" );
                  break;
      case 0x94:  puts ( "Model 397" );
                  break;
      case 0xA0:  puts ( "Model J30" );
                  break;
      case 0xA1:  puts ( "Model J40" );
                  break;
      case 0xA3:  puts ( "Model R30" );
                  break;
      case 0xA4:  puts ( "Model R40" );
                  break;
      case 0xA6:  puts ( "Model G30" );
                  break;
      case 0xA7:  puts ( "Model G40" );
                  break;
      case 0xC4:  puts ( "Model F30" );
                  break;
      default:    printf( "Model code: %s\n", s );
                  break;
   }

/* Get the amount of installed memory */
  odm_set_path("/etc/objrepos");
  /* Get a single ODM object */
  odm_obj = getattr("sys0", "realmem", 0, &how_many);
  memsize = atoi(odm_obj->value) / 1024;
  odm_terminate();
  printf( "Memory   = %d MB\n", memsize );

/* Print the number of processors */
  printf("#processor configured = %d\n", sysconf(_SC_NPROCESSORS_CONF));
  printf("#processor online     = %d\n", sysconf(_SC_NPROCESSORS_ONLN));

}

------------------------------

Subject: 8.05: Updating to 3.2.5

[ formerly in section 1.127 ]

=-=-=-=-=-=-=-= cut here =-=-=-=-=-=-=-=-=-=-=
#!/bin/ksh
# @(#) mktape2disk.sh  creates files from tape on disk.

# change name prefix here
NAME="f"

# from file #i to file #j
integer i=1
integer j

# test arguments
if [ -z "${1}" ]
then
  echo "\nusage: $(basename ${0})  <#files>\n"
  echo "\t: tape drive number (e.g. 0)"
  echo "\t<#files>  : number of files to copy from the tape\n"
  exit 1
fi
device=/dev/rmt${1}.1

# test arguments
if [ -z "${2}" ]
then
  echo "\nusage: $(basename ${0})  <#files>\n"
  echo "\t: tape drive number (e.g. 0)"
  echo "\t<#files>  : number of files to copy from the tape\n"
  exit 1
fi
j=${2}

tctl -f ${device} rewind
if [ $? -ne 0 ]
then
  exit 1
fi

# create tape
while [ ${i} -le ${j} ]
do
    echo "Copy file #${i} of #${j} from (${device}) to disk as (${NAME}${i})."
    dd if=${device} of="${NAME}${i}" bs=200k
    i=i+1
done
tctl -f ${device} rewind
exit 0
=-=-=-=-=-=-=-= cut here =-=-=-=-=-=-=-=-=-=-=

5) Create a new .toc file

   # cd /pub/pmp3250
   # inutoc .
   # pg .toc

6) Place the following file named 'runme.sh' in the PMP directory

=-=-=-=-=-=-=-= cut here =-=-=-=-=-=-=-=-=-=-=
#!/bin/ksh
# @(#) runme.sh for PMP3250
#
INSTP="/usr/sbin/installp"
LOG="/tmp/installp.log"
TEE="/usr/bin/tee"
PATCHDIR=$(pwd)
#
/usr/bin/cp /usr/lpp/info/data/ispaths /usr/lpp/info/data/ispaths.save
#
INFODIR="/usr/lpp/info/$LANG/aixmin"
/usr/bin/mkdir ${INFODIR} 2>/dev/null >/dev/null
if [ ! -w ${INFODIR} ]
then
    print "\n\t*ERROR* Can not (write) access [${INFODIR}]."
    print "\tPlease unmount CD or NFS filesystems.\n"
    exit -1
fi
#
# Commit all ptf's
#
${INSTP} -Xc all 2>&1 | ${TEE} ${LOG}.0
#
# Install latest installp patch
#
${INSTP} -BXacgq -d ${PATCHDIR} bos.obj 3.2.0.0.U422463 2>&1 | ${TEE} ${LOG}.1
#
# Install latest installp patch
#
${INSTP} -BXacgq -d ${PATCHDIR} bos.obj 3.2.0.0.U422467 2>&1 | ${TEE} ${LOG}.6
#
# Run the ptfdir clean utility.
#
/usr/sbin/ptfdir_clean -y -f -v 2>&1 | ${TEE} ${LOG}.2
#
# Install the PMP.    Version 1
#
/usr/lib/instl/sm_inst installp_cmd   \
        -T m -q -a -g -B              \
        -d ${PATCHDIR}                \
        -S '3250 AIX Maintenance Level U493250' \
        -c  -N  -X                    \
        2>&1 | ${TEE} ${LOG}.3
#
# Install the PMP.    Version 2
#
# /usr/sbin/update_all
#
# Install latest installp patch
#
/usr/bin/lppchk -v | ${TEE} ${LOG}.4
#
# Show level of installp patch
#
/usr/bin/lslpp -m bos.obj | ${TEE} ${LOG}.5
#
# Guess you should reboot now.
#
sync;sync
print - "\n\n\tDone......guess you should reboot now !!\n"
exit 0
=-=-=-=-=-=-=-= cut here =-=-=-=-=-=-=-=-=-=-=

7) To run the update on your server

   ===>> Please read the Installation Instructions first <<==

   # cd /pub/pmp3250
   # ./runme.sh

                   ........WAIT...........

   # /etc/shutdown -Fr

8) NFS export the PMP dir as READ-ONLY to all your clients.

9) To update a client system

    a -  Mount the PMP filesystem from the server
    b -  cd 
    c -  execute ./runme.sh
    d -  Unmount PMP filesystem
    e -  reboot

10) To create a copy 1:1 of the tape you received use the script 'mktape.sh'

   # cd /pub/pmp3250
   # mktape.sh 0

=-=-=-=-=-=-=-= cut here =-=-=-=-=-=-=-=-=-=-=
#!/bin/ksh
# @(#) mktape.sh: creates a bootable tape from images on disk

# change name prefix here
NAME="f"

# usage: mktape drive_no
#        drive_no = tape drive number
# test arguments
if [ -z "${1}" ]
then
  echo "\nusage: mktape "
  echo "         : tape drive number (e.g. 0)\n"
  exit 1
fi
device=/dev/rmt${1}.1

tctl -f ${device} rewind
if [ $? -ne 0 ]
then
  exit 1
fi

# create tape
i=1
while test -r "${NAME}${i}"
do
    echo "copy ${i}"
    if [ $i -le 3 ]
    then
      dd if="${NAME}${i}" of=${device} conv=sync bs=1k
    else
      dd if="${NAME}${i}" of=${device} bs=200k
    fi
    let i=${i}+1
done
tctl -f ${device} rewind
exit 0

------------------------------

Subject: 8.06: How do I do remote backup?
From: kraemerf@franvm3.VNET.IBM.COM (Frank Kraemer)

[ formerly in section 1.201 ]

#!/bin/ksh
# @(#) Create a backup tape of the private user data.
#=================================================================#
#   Script :  usave.sh                                            #
#   Author :  F. Kraemer                                          #
#   Date   :  92/02/19                                            #
#   Update :  92/10/29                                            #
#   Info   :  the ultimative backup script                        #
#   Example:  usave.sh /dev/rmt0      -  save to local tape       #
#             usave.sh /save/save.me  -  save to local file       #
#             usave.sh /tmp/pipe      -  save to remote tape      #
#-----------------------------------------------------------------#
PS4="(+) "
#set -x
PROG=$(basename $0)
HOST=$(hostname)
TODAY=$(date +%H:%M:%S)
#
# cleanup
#
cleanup ()
{
ec=$1
error=$2
case "$ec"
in
   "$USAGE_EC")    # usage error
     error="Usage:\t$PROG DeviceName\n" 1>&2
    ;;
   "$NOTAP_EC")    # Tape error
     error="error:\t$PROG: $DEVICE is not available on the system.\n" 1>&2
    ;;
   "$LISTE_EC")    # list error
     error="error:\t$PROG: could not create tar list for $LOGNAME.\n" 1>&2
    ;;
   "$NOTAR_EC")    # tar command error
     error="error:\t$PROG: tar command failed.\n" 1>&2
    ;;
   "$PIPEP_EC")    # pipe error
     error="error:\t$PROG: mknod command failed.\n" 1>&2
    ;;
   "$NORSH_EC")    # rsh error
     error="error:\t$PROG: rsh - Remote Shell command failed.\n" 1>&2
    ;;
   "$RHOST_EC")    # remote host error
     error="error:\t$PROG: Remote Host unknown.\n" 1>&2
    ;;
   *)
   ;;
esac
case "$DEVICE"
in
    #
    # Fix the block size if $DEVICE is a tape device
    #
    /dev/rmt[0-9]*)
        echo "\n\t$PROG: Rewinding tape to begin.........(please wait)\n"
        tctl -f $DEVICE rewind 2>/dev/null
        ;;
    *) ;;
esac
rm -f ${LIST} ${PIPE} 2>/dev/null
[ -n "$error" ] && echo "\n${error}\n"
trap '' 0 1 2 15
exit "$ec"
}
#
# Variables
#
USAGE_EC=1                         # exit code for usage error
NOMNT_EC=2                         # exit code wrong device name
NOTAP_EC=3                         # exit code no tape available
LISTE_EC=4                         # exit code backup list error
NOTAR_EC=5                         # exit code for wrong tar
TRAPP_EC=6                         # exit code for trap
PIPEP_EC=7                         # exit code for pipe
RHOST_EC=8                         # exit code for bad ping
NORSH_EC=9                         # exit code for bad rsh
DEVICE="$1"                        # device to tar into
LIST="/tmp/.tar.$LOGNAME.$$"       #
REMOTEH=""                         # Remote host for backup
REMOTET=""                         # Remote tape for backup
tapedev=                           #
PIPE="/tmp/pipe"                   # Pipe for remote backup
#
# main()
#
tput clear
echo "\n\t$PROG started from $LOGNAME@$HOST on $TERM at $TODAY.\n"
rm -f $LIST 2>/dev/null
#
# Trap on exit/interrupt/break to clean up
#
trap "cleanup $TRAPP_EC \"Abnormal program termination. $PROG"\"  0 1 2 15
#
# Check command options
#
[ "$#" -ne 1 ]  &&  cleanup "$USAGE_EC" ""
#
# Check device name
#
[ `expr "$DEVICE" : "[/]"` -eq 0 ] && cleanup "$NOMNT_EC" \
        "$PROG: Backup device or file name must start with a '/'."
#
# Check tape device
#
case "$DEVICE"
in
    #
    # Fix the block size if $DEVICE is a tape device
    #
    /dev/rmt[0-9]*)
        #
        echo "\n\t$PROG: Verify backup media ($DEVICE)............\n"
        #
        # see if a low or high density tape device was specified
        # (eg rmt0.1)
        density="`expr $DEVICE : \
                "/dev/rmt[0-9]*\.\([0-9]*\)"`"
        #
        # strip /dev/ from device name and
        # get the base name (eg translate:
        # /dev/rmt0.2 to rmt0)
        #
        tapedev="`expr $DEVICE : \
                "/dev/\(rmt[0-9]*\)[\.]*[0-9]*"`"
        #
        # Check if the tape is defined in the system.
        lsdev -C -c tape -S Available -F "name" | grep $tapedev >/dev/null 2>&1
        rc=$?
        [ "$rc" -ne 0 ] && cleanup "$NOTAP_EC" ""
        #
        # Restore old tape name.
        #
        [ "${density:-1}" -lt 4 ] && density=1 || density=5
        DEVICE="/dev/${tapedev}.${density}"
        echo "\n\t$PROG: Insert a tape in ($DEVICE)........(press enter)\n"
        read TEMP
        echo "\n\t$PROG: Rewinding tape to begin...........(please wait)\n"
        tctl -f $DEVICE rewind 2>/dev/null
        ;;
    #
    # Backup is done on remote host. The remote shell facility
    # must be set up and running.
    #
    ${PIPE}*)
        #
        echo "\n\t$PROG: Assuming remote backup via network.\n"
        echo "\t$PROG: Enter name of Remote Host   ===> \c"
        read REMOTEH
        echo "\n\t$PROG: Pinging Remote Host to test connection.\n"
        ping ${REMOTEH} 1 1 >/dev/null 2>&1
        rc=$?                                    # give up unknown host
        [ "$rc" -ne 0 ] && cleanup "$RHOST_EC" ""
        JUNK=$(rsh ${REMOTEH} "/usr/sbin/lsdev -C -c tape -S Available")
        rc=$?                                    # give up rsh failed
        [ "$rc" -ne 0 ] && cleanup "$NORSH_EC" ""
        echo "\t$PROG: Available Tapes on ${REMOTEH} are :\n\n\t\t${JUNK}\n"
        echo "\t$PROG: Enter name of Remote Tape (e.g. /dev/rmt0) ===> \c"
        read REMOTET
        echo "\n\t$PROG: Insert tape on ${REMOTEH} in ${REMOTET}..(press enter)"
        read TEMP
        echo "\t$PROG: Rewinding Remote Tape ${REMOTET} on ${REMOTEH}.\n"
        rsh ${REMOTEH} "tctl -f ${REMOTET} rewind"
        rc=$?                                    # give up rsh failed
        [ "$rc" -ne 0 ] && cleanup "$NOTAP_EC" ""
        rm -f ${PIPE} 2>/dev/null
        mknod ${PIPE} p
        rc=$?                                    # give up mknod failed
        [ "$rc" -ne 0 ] && cleanup "$PIPEP_EC" ""
        cat ${DEVICE} | rsh ${REMOTEH} "dd of=${REMOTET} obs=100b 2>/dev/null" &
        ;;
    *)  ;;
esac
#
# Prepare the list
#
echo "\n\t$PROG: Create list of files to be saved...."
find $HOME -print > $LIST
rc=$?
[ "$rc" -ne 0 ] &&  cleanup "$LISTE_EC" ""
#
# tar the files
#
echo "\n\t$PROG: Changing current directory to (/)...."
cd / > /dev/null 2>&1
echo "\n\t$PROG: Running tar format backup from user ($LOGNAME)...."
tar -cvf "$DEVICE" -L "$LIST"
rc="$?"
[ "$rc" -ne 0 ]  && cleanup "$NOTAR_EC" ""
#
# Backup completed
#
TODAY=$(date +%H:%M:%S)
echo "\n\t$PROG ended at $TODAY............................\n\n"
cleanup 0

------------------------------

Subject: 8.06: How do I do remote backup? (cont.)
From: Henk van Doorn 

#!/bin/ksh
#######################################################################
#     rmksysb                                                         #
#######################################################################
#                                                                     #
# Description:                                                        #
#       creates a bootable mksysb backup of a remote system running   #
#	AIX 3.x or lists the Table of Contents of the current tape    #
#                                                                     #

Section 1 of 2 - Prev - Next

Back to category aix-faq - Use Smart Search
Home - Smart Search - About the project - Feedback

© allanswers.org | Terms of use

LiveInternet