May 26

By default, solaris will only let you add 255 IP addresses to an interface. You’ll know you hit the limit when you get an out of buffer message when you try to add your next one. In Solaris 2.5, you’re pretty much stuck with this limitation. In solaris 2.6 and higher, you can run the followng to up that limit as high as 8192. Past 8192, you’ll need to add another interface.

/usr/sbin/ndd -set /dev/ip ip_addrs_per_if 8192

May 22

Windows file names can be really frustrating, so I found a script on the web that recurses a directory and replaces every space it finds with an underscore. Good stuff.

IFS=’

#rename direcotories
for (( i=0; i<=j ; i++ )); do
for name in `find -mindepth $i -maxdepth $i -iname "* *" -printf "%p\n"`; do
newname=`echo "$name" | tr " " "_"`;
echo "$name" "$newname";
mv "$name" "$newname";
done;
done
#rename files
for name in `find ./ -iname "* *" -printf "%p\n"`; do
newname=`echo "$name" | tr " " "_"`
echo "$name" "$newname"
mv "$name" "$newname"
done

May 8

the -k parameter lets you sort based on a key field instead of the first string. To use it to sort a batch of strings that look like this
-rw-rw-r-- 1 user prod 2406912 May 7 05:00 ./backups/daily/BaseClassAO-050708.tar
-rw-rw-r-- 1 user prod 1703424 May 7 05:00 ./backups/daily/BaseClassP-050708.tar

by the file size, use sort like so

sort -n -k5

telling sort to use the 5th field (as delimited by the space character) to sort on.

Apr 23

A quick way to see what type of hardware is installed on a solaris machine is to use the prtdiag command. It may be located in your path, or it may be located in /usr/platform/$ARCH/sbin.

prtdiag

or

/usr/platform/`uname -i`/sbin/prtdiag

Apr 22

While I have a good monitoring system setup, some of my nodes can’t be monitored and require manual checkups. To speed things up, I use a little bash script to log into each host and check a few things out. This snippit below walks through each host in my host file and prints out file systems that are at greater then 90% utilization.

for i in `cat /etc/hosts | grep -v localhost | awk {‘print $3′}`; do
echo $i;
ssh $i “df -k | sed 1d | awk ‘\$5>90 {print}’”;
done

« Previous Entries Next Entries »