The World is Flat

The World is Flat (Wikipedia)

One of my co-workers has recommended this and it looks pretty interesting. My favorite flattener:

#4: Open Sourcing: Friedman considers this ‘the most disruptive force of all’

This may be true, but it seems like companies are still pretty skeptical about technologies that make, for example, this blog possible and convenient for me to update. I am very interested in how AIX will grow in conjunction with Linux and open source software.

base.ksh by Heiner Steven converts number formats

This and other Heiner Steven scripts can be found at heinersteven.org

#! /usr/bin/ksh
##########################################################################
# Title      :	base.ksh - print number to different bases (KSH version)
# Author     :	Heiner Steven 
# Date       :	1995-03-07
# Requires   :	bc, ksh
# Category   :	Desktop
# SCCS-Id.   :	@(#) base.ksh	1.4 04/02/18
##########################################################################
# Description
#
# Changes
# 21.03.95 hs	fixed error occuring with 0xb as input (0.2)
# 14.05.96 hs	Rewritten for ksh. Speed increasement: 60x (1.0)
# 17.05.96 hs	Reset output base to 10 (1.1)
##########################################################################

PN=${0##*/}				# Program name
VER='1.4'

function Usage
{
    print -u2 "$PN - convert number to different bases, $VER (hs '96)
usage: $PN [number ...]

If no number is given, the numbers are read from standard input.
A number may be
    binary (base 2)		starting with 0b (i.e. 0b1100)
    octal (base 8)		starting with 0  (i.e. 014)
    hexadecimal (base 16)	starting with 0x (i.e. 0xc)
    decimal			otherwise (i.e. 12)"
    exit 1
}

function Msg
{
    typeset i
    for i
    do print -u2 "$PN: $i"
    done
}

function PrintBases
{
    typeset -u Number			# Convert to upper case (for "bc")
    integer Base
    typeset Dec Result

    # Determine base of the number
    for Number
    do
	case "$Number" in
	    (0B+([01]))				# binary
		Base=2	
		Number=${Number#0B} ;;
	    (0X+([0-9A-F]))			# hexadecimal
		Base=16
		Number=${Number#0X} ;;
	    (0+([0-7]))				# octal
		Base=8
		Number=${Number##0} ;;
	    ([1-9]*([0-9]))			# decimal
		Base=10;;
	    (*([0-9A-F])+([A-F])*([0-9A-F]))	# hexadecimal, no prefix
		Base=16;;
	    (*)
		Msg "illegal number $Number - ignored"
		continue;;
	esac

	# Convert to decimal number. Do not use ksh, because
	# there is an upper limit to the maximum integer size.
	set -e				# Terminate at errors
	print -p "ibase=$Base; $Number; ibase=A"
	read -p Dec

	# Let "bc" do the conversions. "bc" will
	# echo "GNUELPF" for the last line.
	# Assign the result of c() to a dummy to prevent
	# "bc" from printing the "result" of the function.
	print -p "d=c($Dec)"

	# Read lines from "bc", build one line
	Result=
	while read -p && [[ $REPLY != GNUELPF ]]
	do
	    Result="${Result:+$Result	}$REPLY"
	done
	set +e
	print "$Result"
    done
}

if (( $# > 0 ))
then
    while getopts :h Opt
    do
	case "$1" in
	    (h)	Usage;;
	    (*)	Usage;;
	esac
    done
    shift OPTIND-1
fi

bc |&					# Start "bc" as co-process
# DEBUG:
# tee in | bc | tee out |&

# Define a "bc" function for base conversion, because "bc" would
# run out of "string space" for large input otherwise.
# The "GNUELPF" string tells PrintBases() that the end of
# the calculations is reached.
set -e					# Terminate at errors
print -p '
/* Convert x to some other bases */
define c (x) {
obase=16; "hex="; x
obase=10; "dec="; x
obase=8;  "oct="; x
obase=2;  "bin="; x
obase=A
"GNUELPF
"
}
'
set +e

if (( $# > 0 ))
then
    PrintBases "$@"
else					# read from stdin
    while read Line
    do
	PrintBases $Line
    done

mapgfs command

 


#!/bin/ksh

## This command simply maps powerdisk devices to filesytem names
## and nsd devices and then runs the mmlsdisk command for each
## If you aren't using emc, change DISKEXCLUDE


function callMmlsdisk {

# Run mmlsdisk and lspv for each record and merge the results

/usr/lpp/mmfs/bin/mmlsdisk $DEVICE | grep nsd | while read NSD RESTOFLINE
   do
   lspv | grep $NSD | grep $DISKEXCLUDE
   echo $RESTOFLINE
   done | xargs -n 10 | awk '{print $1,"\t",$6,"\t",$3}'
}

# Initial variables

TEMPFILESYSTEMS=/tmp/$$filesystems
FILESYSTEMRECORD=/tmp/$$fsrecord
DISKEXCLUDE=power

# Create a mmfs only version of /etc/filesystems

grep -p "= mmfs" /etc/filesystems > $TEMPFILESYSTEMS

# Now create a format which grabs two lines and merges them down to one line
# here is an example:
# /dir/dbf: dev = /dev/dbf1
# /dir/log: dev = /dev/log1
# /dir/sys: dev = /dev/sys1

egrep ":|/dev" $TEMPFILESYSTEMS | xargs -n4 > $FILESYSTEMRECORD

# Use only the first and last line, loop to print

awk '{ print $1,$4}' $FILESYSTEMRECORD | while read FSNAME DEVICE
     do
       echo  # space to divide records
       echo $FSNAME ---FG------NSD---------   # Heading
       callMmlsdisk $DEVICE
     done

# Remove temporary files
rm $TEMPFILESYSTEMS $FILESYSTEMRECORD

Use putty and vnc to forward a linux desktop to a Window in XP

For this you will need the VNC viewer, I use vnc-4.0-x86_win32_viewer.exe.  I configure putty for port forwarding and then I open a window to the server that I want to connect to:

Next I set up the vnc viewer to use my forwarded port:

 

Finally, I have to make sure vnc on the server is lined up with the port I think it is:

This command must be run:

vncserver -geometry 1280×1024 -localhost

When I ran it, it actually connected to port 5, not 2. You only know this by looking in a log file.  Kill the session on 5 and clean up on /tmp files (or change your putty forwarding to be 5905 instead of 5902:


vncserver -geometry 1280x1024 -localhost

Warning: nad0019linux01:1 is taken because of /tmp/.X11-unix/X1
Remove this file if there is no X server nad0019linux01:1

New 'X' desktop is nad0019linux01:2

Starting applications specified in /home/jrigler/.vnc/xstartup
Log file is /home/jrigler/.vnc/nad0019linux01:2.log

 

 

~/.vnc/xstartup  (this gets run remotely when you connect, in this case, it starts gnome)


#!/bin/sh

xrdb $HOME/.Xresources
gnome 

You may also have to reset your vnc password on the server with the vncpasswd command.

Thats it.  It allows me to have a linux graphical environment (gnome) hosted on a pSeries Partition that I can get at from my Windows laptop.  I have two screens and can fill one with linux and when my mouse goes over there, everything works.  The only thing I can’t do is cut and paste into Windows:

 

Setup NTP date sync

Make sure you set up ntp to work and then just run it every time. Use dsh date to check that you are working. Below is a configuration file to be put into /etc/rc.d/rc2.d as Sntpd and Kntpd:

#!/bin/ksh

##################################################
# name: Xntpd
# purpose: script that will start or stop the time daemon. Configure it in /etc/ntpd.conf
##################################################

case "$1" in
start )
        startsrc -s xntpd
        ;;
stop )
        stopsrc -s xntpd
        ;;
* )
        echo "Usage: $0 (start | stop)"
        exit 1
esac

/etc/ntp.conf

# @(#)48        1.2  src/tcpip/etc/ntp.conf, ntp, tcpip510 2/16/96 10:16:34
#
#   COMPONENT_NAME: ntp
#
#   FUNCTIONS: none
#
#   ORIGINS: 27,176
#
#
#   (C) COPYRIGHT International Business Machines Corp. 1996
#   All Rights Reserved
#   Licensed Materials - Property of IBM
#   US Government Users Restricted Rights - Use, duplication or
#   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
#
#
#
#
# Default NTP configuration file.
#
#   Broadcast client, no authentication.
#
#broadcastclient
driftfile /etc/ntp.drift
tracefile /etc/ntp.trace

server mydomaincontroller01
server mydomaincontroller02

peer mypeer01
peer mypeer02

To sync to the ntp server immediately and only if xntpd isn’t running:

ntpdate mydomaincontroller01

Make sure system will boot OK

1. bosboot -ad /dev/hdisk5



root@nad0019aixd09/dev> bootlist -m normal -o
hdisk5 blv=hd5


bootlist -m normal -o

ln rhdisk5 ipldevice   ( use ln to create a copy of the raw devices if necessary)

These need to all exist and point to rootvg, rhd5, and rhdiskX ( being whereever the boot image is):

root@nad0019aixd09/dev> ls -l | grep -i ipl
crw-rw----   1 root     system       10,  0 Jan 11 2006  IPL_rootvg
crw-rw----   2 root     system       10,  1 Apr 23 13:02 ipl_blv
crw-------   2 root     system       20,  6 Apr 23 12:19 ipldevice

root@nad0019aixd09/dev> ipl_varyon -i


PVNAME          BOOT DEVICE     PVID                    VOLUME GROUP ID
hdisk2          NO              00033f6a7c51d6bd0000000000000000        00cdeaea00004c00
hdisk4          NO              00cdeaea38c938d20000000000000000        00cdeaea00004c00
hdisk5          YES             00033f6a7c4c17d40000000000000000        00cdeaea00004c00  <--- this one is important


Set License for Micro-Focus Cobol

Howto install latest cobol on 5.3

1. Get the image from cd
2. Untar in the /opt directory: cd /opt ; tar -xvf $DIR/cobol.tar (name or format may be different)
3. cd /opt/microfocus/cobol
4. ./install
5. Agree to License
6. Look at environment (by hitting space) and confirm that you understand it
7. Pick no to use without Java
8. Pick yes to install LMF, stop currently running if necessary
9. Allow only superuser access to License Admin System
10. Let it start at next bootup ( the /etc/mflmrcscript runs, notice that it points to the license manager now installed in /usr/lib/mflmf, not the one under /opt)
11. Pick 64 bit environment

Howto set the correct license for cobol:

1. cd /usr/lib/mflmf
2. ./mflmcmd (if this fails with a corrupt database error, run lmfdbrecover)
3. Enter capital I to install your license:

For 1 User:
COBOL Serial Number: PEOPLESOFT-SX-DEV64
COBOL License Code: 12345 12345 12345 12345 12345

It will either say the license is now installed or is already in the database.

4. Start the license manager with the rc script: /etc/mflmrcscript ( you should see mflm_manager running )

Howto Check license with apptrack (although the license manager mflmf is under, /usr/lib/mflmf, the application server license checker is under /opt)

1. export COBDIR=/opt/microfocus/cobol
2. cd /opt/microfocus/cobol/aslmf
3. ./apptrack (pick option 1, license list), the other install options don’t really work here

Compile and run a test cobol program:

1. export LD_LIBRARY_PATH=/opt/microfocus/cobol/lib
2. PATH=$PATH:/opt/microfocus/cobol/bin
2. cd /opt/microfocus/cobol/demo
3. cob64 hello.cbl
4. cobrun hello.int

——————————————————-

Here is how to install a later version:

# ./mflm_cmd

Micro Focus License Manager Command Line Interface
————————————————–
Select the function you require from the list:
License Install – Enter ‘I’
I
Ready to install license
Enter the Serial Number part of the License Key:
90000000999999+
Enter the License Number part of the License Key:
12345 12345 12345 12345 1234
License added ok

# cd /usr/lpp/cobol/aslmf
# ./apptrack
You must set an access password, before proceeding
Enter 6 characters as the password
(6 spaces removes password) just hit space bar 6 times
******
Please re-enter the new password
******
Password removed

Application Server License Administration System – AppTrack
———————————————————–
1. License List
2. License Summary
3. License Install
4. License Uninstall
5. Change/Set Password
6. Reinitialize Licensing
7. Current Users
9. Quit
Enter the Menu Selection

Ready to install license
Enter the Serial Number part of the License Key:
90000000999999+
Enter the License Number part of the License Key:
12345 12345 12345 12345 1234
License installed ok