Category Archives: AIX

Bulk Remove AIX Print Queues

I have about 50 HP JetDirect print queues on an AIX system that I wanted to remove in a more automated way. The following KSH script is what I came up with to remove the device and queue.

The script attempts to ping the print queue (queues are added by DNS name). If the ping fails, I remove the device using rmqueudev and then remove the queue using rmque.


for i in $(lpstat | awk '{print $1}')

ping -c 1 -w 1 $i >/dev/null 2>&1

if [ $? -ge 1 ];
    echo "Purging $i"
    rmquedev -q $i -d hp@$i
    rmque -q $i

After running this, I have 6 valid print queues that remain on the AIX system.

Get Process ID of an Established TCP Connection in AIX

There are numerous ways to accomplish getting the PID for an established network connection in AIX and Linux using tools like ss or more popular lsof.  In my situation, the system I was working on did not have ss or lsof, so I used netstat and rmsock.
If I know I have an established connection to a remote host, I can use netstat to narrow down and obtain the PCB/ADDR using the following command.

~ # netstat -naA|grep
f10000f3026fcb58 tcp4       0      0 ESTABLISHED

The first column of the netstat output is PCB/ADDR; using this value, I will use rmsock to identify the process.

~ # rmsock f10000f3026fcb58 tcpcb
The socket 0x26fc800 is being held by proccess 1302658 (x_ieswitch).

I can see the process ID (PID) is 1302658; to obtain more information, a simple ps command is executed.

~ # ps e 1302658
1302658  pts/0 A     0:00 x_ieswitch p1_webxt_out 1 p1_webxt_out WEBXTOUT 5 _=

There are many ways to achieve what was done here as I had mentioned – such as using lsof, ss or even taking a look at some of the resources here: IBM DeveloperWorks Wiki

Test Dial on Modem in AIX

Had an issue with dialout on an AIX system this morning.  Problem resolved, but I learned a pretty handy little command for testing dial-out (I didn’t have a buttset with me).
Using cu -n -d -l tty2, I can dial-out to my cellphone to help in troubleshooting the problem.

# cu -n -d -l tty2
Please enter the number: xxxxxxxxxx
altconn called
Device Type ACU wanted
ttylock tty2 succeeded
Attempting to open /dev/tty2
clear O_NDELAY
filelock: ok
fixline(7, 19200)
gdial(fcmulhays) called
expect: ("")
got it
sendthem (DELAY
expect: (OK)
AT^M^M^JOKgot it
sendthem (PAUSE
nap(25) ATE1QV1M1Y1&R&D&E7#PDTxxxxxxxxxx^M)
expect: (CONNECT)
^M^JATE1QV1M1Y1&R&D&E7#PDTxxxxxxxxxx^M^Z[1] + Stopped (SIGTSTP)

Here we see it dial the number, my cellphone (indicated with X’s — creepers!).
This failed so I ^C the process. I reworked some of the terminations on the block from demarc and tried again. The next time was successful and I had received the dial-out call from AIX.

Backspace in terminal on AIX

Instead of using Shift+Backspace to backspace on an AIX terminal, you can use the following setting in the .profile:

stty erase '^?'

Save the file and logout and back into the AIX terminal and Backspace should work now.

Monitor System Performance in AIX

An easy way to get a quick overview of system performance on an AIX server is to use the topas command.

The topas command reports selected statistics about the activity on the local system. The command uses the curses library to display its output in a format suitable for viewing on an 80×25 character-based display or in a window of at least the same size on a graphical display. The topas command requires the and filesets to be installed on the system.

topas topas running
[su_box title=More Information box_color=#2b7abf][/su_box]

FastClaims for Tiger in AIX

So I’ve discovered that FastClaims in Allscripts Tiger AIX servers are stored in the following location.

When a receipts are batched, they are stored in /m2/MF01/CLAIM499

When clicking on “Batch” -> Fast Claims, it then copies /m2/MF01/CLAIM499 to /src/APPS/ECONNECT/ARCHIVE/TS/CLAIM499_1.3101165443_20120131165507385. You will notice this filename is comprised of CLAIM499_[companynumber].ddmmhhmmss.yyyymmddhhmmssnnnn in gzip format.

The original /m2/MF01/CLAIM499 is renamed to /m2/MF01/oldCLAIM499.

The header of the file AA00000000 indicates start of each claim for company and the end is represented by ZA00000000 in the same file. Replace zeros with account number padded.

Note: When modifying claim file, use R in vi to replace instead of i to insert. It will void the length of the columns and cause all sorts of problems.

Get serial number of AIX

Get the serial number of an AIX system.

# Get serial number of AIX server;
# October 28, 2009 Rich Kreider
ser_num=`lsattr -El sys0 -a systemid | awk '{print $2}' | awk -F, '{print $2}'`
prefix=`echo ${ser_num} | cut -c3-4`
suffix=`echo ${ser_num} | cut -c5-9`
echo ${prefix}-${suffix}

AIX/Unix Common Commands

AIX/Unix Commands

free			- lists available disk space
dfdb			- lists dbspaces on the system.  use ifxksh to initialize the ifx environment first
who -b			- displays last date system was rebooted
oslevel			- lists the version of the operating system
bootinfo -r 		- lists total amount of real memory installed (divide by 1024 to get MB)
startjs			- starts the job server
stopjs			- stops the job server
startvlink		- starts any interface link procedure incling Misys Vision/Optimum Charge Daemon
stopvlink		- stops any interface link procedure incling Misys Vision/Optimum Charge Daemon

Physical Volume

lspv			- lists harddisks on the system and the volume groups they are attached to
lspv -l hdisk#		- lists logical volumes on the file systems
mount			- displays currently mounted file systems
lspv physvolname	- displays information about the physical volume 'physvolname'
lspv -p physvolname	- lists physical partitions associated with this physical volume 'physvolname'
lsps -a			- lists paging space associated with physical volume  Note:  if Used=75%, you need memory

Volume Group

lsvg volgrpname		- lists details about the volume group (such as PP size, #free)
lsvg -p volgrpname	- displays name and status of physical volumes for volume group


lsdev -Cc memory	- lists all installed memory cards
lsdev -Cc adapter	- lists all interface cards installed on the system
date			- shows system date and time
errpt | more		- displays error log entries in a one-line-per-entry format
errpt -a		- displays error log in same format as the Utility menu option


penable tty#		- directs UNIX to reset a disabled terminal
pdisable tty#		- takes terminal off-line, resets terminal settings

Spooler Commands

lptstat			- shows status of all spooled printers
lptstat -pSPxx		- shows status of a specified printer
qcan -pSPxx -xJOBx	- cancels JOB#
qcan -X			- cancels all print jobs
cancel JOB#		- cancels JOB#
stopsrc -s qdaemon	- stops qdaemon
startsrc -s qdaemon	- starts qdaemon
ps -ef | grep qdaemon	- checks to see if qdaemon is running
qmov -m SP## -8		- moves job #8 to SPxx
qmov -m SP## SP##	- moves all jobs from SP## to SP##
qmove -u userID -m SP##	- moves all jobs for userID to SP##
qhld 8			- puts job #8 on hold
qhld -P SP##		- puts all jobs for SP# on hold
qhld -r 8		- releases held job #8
qhld -r -P SP##		- releases all held jobs for SP##
qadm - USP##		- takes the specified queue to an up status
qadm -DSP##		- takes the specified queue to a down status

Printing and Viewing Files

lp SP## filename	- prints contents of file to a specific printer
cat filename | more	- prints contents of file to the screen one page at a time from the beginning of the file
more filename		- prints contents of file to the screen one page at a time
tail -# filename	- shows last # of lines of file
tail filename		- shows last 10 lines of file
printout filename	- Misys print command alias.  After typing this command, the system prompts to select a printer.