In trying to make a php color selection tool, I ended up with some wierd mistakes like the one above. I liked them all so much I created the page below:
Monthly Archives: September 2008
Querying an LDAP server with AIX ldapsearch
ldapsearch -b DC=deadlycoffee,DC=com -h ldapserver -D CN=”James T. Kirk,OU=USSENT01,OU=FEDERATION,DC=deadlycoffee,DC=com” -w “$PASSWORD” “(sAMAccountName=jtk*)”
Make sure you use the same CN that you find with this Windows graphical tool:
Employee Productivity Essay Website
Set PS1 to update your terminal title
You must use bash for this one to work, when you switch users, your title bar will change:
PS1=”\[\033]0;\u@\h: \w\007\]”‘$PWD> ‘;
Add this to /etc/profile and it will get called by everyone
If you are using X11, xdpyinfo gives you lots of info, but this doesn’t work on cygwin
How to load vmstat info into a database
1. Create the database with tables labelled with hostname,date, and all the vmstat fields in order. Put a unique constraint on the hostname_date.
$ vmstat 1 1 | grep avm
r b avm fre re pi po fr sr cy in sy cs us sy id wa pc ec
2. setup a command to pipe inserts right into the database, in my case I pipe into a remote command:
echo “insert command to generate” | ssh $remotehost sql
‘sql’ above is a script that connects via tds to a Windows database ( yea I know, Windows ).
3. Create a simple capture job and run it every 15 minutes:
4. I just run this command every 15 minutes. Because of constraints anything already loaded just fails.
( loadvmstat “09-25-2008” ; echo ; echo ) | ssh nad0019linux01 sql
Here is an example of a report made with MicroSoft Visual Studio pulling from the database ( double click to see the details ):
daysago.pl
#!/usr/local/bin/perl
# yesterday = time-86400
# Given a number, it will count back that many days and print the date
$offset = 86400 * @ARGV[0];
@months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
@weekDays = qw(Sun Mon Tue Wed Thu Fri Sat Sun);
($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear, $daylightSavings) = localtime(time – $offset);
$year = 1900 + $yearOffset;
$theTime = “$hour:$minute:$second, $weekDays[$dayOfWeek] $months[$month] $dayOfMonth, $year”;
$dayOfMonth=sprintf(“%02d”,$dayOfMonth);
$monthno=sprintf(“%02d”,$month+1);
printf “$monthno $dayOfMonth $year\n”;
unixODBC/freetds on p5 suse to connect to SQLServer
I was able to compile freetds-0.64 on SUSE (2.6.16.21-0.8-ppc64).
Then I compiled unixODBC to make use of it.
Use tsql to check your connection:
jrigler:/usr/local/bin> tsql -H $host -p $port -U $user -P $password
locale is “en_US.UTF-8”
locale charset is “UTF-8”
1
Now set up odbc.ini so that isql will work:
jrigler@nad0019linux01:/usr/local/etc> more odbc.ini
[ODBC Data Sources]
[DBAR]
Driver = /usr/local/lib/libtdsodbc.so
Description = DBAReporting
Trace = Yes
Server = nad0019st01.brinksinc.com
Database = DBAReporting
Port = 1433
TDS_Version = 8.0
DontDLClose = 1
Finally you can test your connection with isql:
isql -v $DATASOURCE $USER $PASSWORD
Open up a prettier aixterm or xterm with cygwin
Tired of your cygwin hosted terminals failing and using default fonts? You have to remotely specify local fonts to get around this:
aixterm -fn 8×16 -fs 8×16 -bg white -fg black -T Title
xterm -fb 8×16 -fn 8×16 -bg white -fb black
Test local network speed
This is a hack that any true network admin. would probably shoot holes in, but for me it works pretty good. It simply initiates a transfer of 1GB across the main network interface. If you specify a remote server, it transfers it, otherwise you transfer to yourself. Dev null and dev zero are used to remove disk access from the equation:
How to drop into maintenance shell during an mksysb install
I was cloning a system from a NIM mksysb at AIX 5.3 ML 7 and chose the option to ‘reduce the filesystem’ sizes. This seemed to work fine, but it reduced the size of /tmp to a point that it could not create a boot image when it got to that part of the install. No problem, I just went to the maintenance shell, removed some useless files, and reran the command. The bosboot worked fine. When I exited from the maintenance shell, the install continued and finished successfully. Unless you get failures during the actual restore command, you can often figure out what went wrong and just continue. Sysback operates the same way. It appears to have retried the command, because when I continued on, it looks like it tried the mksysb again:
0301-152 bosboot: not enough file space to create: bootimage /tmp has 31164 free KB. bootimage needs 36242 KB. BOS Install: Could not create boot image. ID# OPTION 1 Continue 2 Perform System Maintenance and Then Continue Enter ID number: 2 # bosboot -ad /dev/hdisk0 0301-152 bosboot: not enough file space to create: bootimage /tmp has 31160 free KB. bootimage needs 36242 KB. # cd /tmp (Remove a bunch of extra stuff you don't need anyway, in this case old Oracle dumps or patch installs) # bosboot -ad /dev/hdisk0 bosboot: Boot image is 35867 512 byte blocks. # exit Please wait... Approximate Elapsed time % tasks complete (in minutes) 87 14 Creating boot image. Copyright BULL 1993, 2007. Copyright Digi International Inc. 1988-1993. Copyright Interactive Systems Corporation 1985, 1991. ... US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. forced unmount of /var Rebooting . . . Approximate Elapsed time % tasks complete (in minutes) 87 14 Creating boot image. Copyright BULL 1993, 2007. Copyright Digi International Inc. 1988-1993. Copyright Interactive Systems Corporation 1985, 1991. Copyright ISQUARE, Inc. 1990. Copyright Mentat Inc. 1990, 1991. Copyright Open Software Foundation, Inc. 1989, 1994. Copyright Sun Microsystems, Inc. 1984, 1985, 1986, 1987, 1988, 1991. All rights reserved. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. forced unmount of /var Rebooting . . .
After that everything works fine.