0

Kill Usage

kill -HUP PID kill -TERM PID kill -KILL PID (I did not write this, I just found it and posted it here for my own reference.) Why does everyone jump straight to -9? DO NOT USE -9 AS YOUR FIRST KILL SIGNAL. Try a nice friendly -HUP … perhaps a little stronger -TERM. If, for some reason, these don’t work, knock a little louder with -KILL (ie: -9), but don’t whine if something else gets hosed due to the strong signal (not to scare anyone, it’s unlikely that anything critical is happening anyway, any more than just writing a file–… Continue Reading

0

Cheat Sheet

This is common stuff that I always forget at the wrong moment, so I print this and put it on my wall at work. shell : To see what shell you are using (being in just “sh” explains a lot): echo $SHELL Make vi your command line editory: set -o vi Or, if you are still in sh, to switch to ksh and set vi as the command line editor: ksh -o vi crontab: minutes(0-59) hours(0-23) dates(1-31) months(1-12) days(0-6) * * * * * command Set your backspace key to work: stty erase BACKSPACE (It may be you just need… Continue Reading

0

Screen Notes

Telnet into your server. Now run: screen -R -T vt100 Now do whatever you want, open a file with less, edit a file in vi, or start a TUI, or whatever. Now hit that big X in the upper corner. That is right, just toast your telnet session, don’t exit out if it, just toast it. Now log into your server again. Now run: screen -R -T vt100 You should be right back where you left from! Screen does not terminate when your session drops, and it holds whatever programs, or sessions you have open with it open too. Even… Continue Reading

0

Filesystem Corruption on a Veritas Disk

You will need to: 1) boot off of the oscopy disk from the ok prompt boot oscopy -s 2) stop the Veritas volumes vxvol -g rootdg stopall run a vxprint -htrg rootdg and make sure the volumes are disabled 3) fsck -o f -y /dev/rdsk/c#t#d#s0 where c#t#d# it the rootdisk from a vxdisk list reitterate until it gives no errors, or until it only gives the “FILE SYSTEM STATE IN SUPERBLOCK IS WRONG” error. root@hostname: vxdisk list DEVICE TYPE DISK GROUP STATUS c1t0d0s2 sliced appldg01 appldg online c1t1d0s2 sliced appldg02 appldg online c1t2d0s2 sliced – – error c2t0d0s2 sliced rootdisk… Continue Reading

0

Useful Links for Unix Admins

Network Calculators: http://www.subnetmask.info/ Miscilaneous Solaris Notes: http://www.brandonhutchinson.com/Miscellaneous_Solaris_notes.html NIC Speed: http://docs.sun.com/source/816-2128/paramset_2.html Java slow? Research. Ideas: link1 link2 Php arrays: http://us3.php.net/manual/en/function.in-array.php SUN Account PW’s and locking/non-login accts. http://blogs.sun.com/gbrunett/entry/managing_non_login_and_locked

0

Replace Text in Files with Perl

Here’s a really quick way to edit a bunch of files in a search and replace manner. For example, I had 80 files for sending test transactions and had to change the IP Addr when I copied them to each server. I could have manually edited each one, but by using the following, I was able to change it in all 80 in a matter of about 10 seconds. It’s done using “perl” from the command line and is similar to using global replaces within “vi” if you’ve ever used that. perl -pi -e ’s/wordToFind/replaceWithThisWord/’ *.fileExtension perl -pi -e ’s/wordToFind/replaceWithThisWord/g’*.fileExtension… Continue Reading

0

Solaris Patch Return Codes

# 0 No error # 1 Usage error # 2 Attempt to apply a patch that’s already been applied # 3 Effective UID is not root # 4 Attempt to save original files failed # 5 pkgadd failed # 6 Patch is obsoleted # 7 Invalid package directory # 8 Attempting to patch a package that is not installed # 9 Cannot access /usr/sbin/pkgadd (client problem) # 10 Package validation errors # 11 Error adding patch to root template # 12 Patch script terminated due to signal # 13 Symbolic link included in patch # 14 NOT USED # 15… Continue Reading

0

Expect

Expect is really cool, and you can use autoexpect to MAKE an expect script from a session, like a macro recorder! http://www.linuxjournal.com/article/3065 http://www.oreilly.com/catalog/expect/chapter/ch03.html Here is my script to just telnet to port 25 to see the Sendmail version: set timeout 10 spawn telnet $argv 25 match_max 100000 expect -exact “sendmail” send — “quitr” expect eof It was made with autoexpect and then edited, there is some more stuff in the file autoexpect spit out.

0

Use awk to combine lines

Problem: We have a text file containing individual records spanning multiple lines. We want to combine them into one line each. For example, given: fs001d1 VERSION: 8.12.10 fsams001 VERSION: 8.13.7 fsams04p VERSION: 8.13.8 fsams05p VERSION: 8.13.8 fsams06p VERSION: 8.13.8 We want: fs001d1 VERSION: 8.12.10 fsams001 VERSION: 8.13.7 fsams04p VERSION: 8.13.8 fsams05p VERSION: 8.13.8 fsams06p VERSION: 8.13.8 cat output | awk ‘{d=d””$o} /VERSION/ { print d d=”” }’