Displaying the Exit status of a UNIX or Linux command

Easy Linux Commands: Working Examples of Linux Command SyntaxFrom my upcoming book Easy Linux Commands:

Whenever a command or shell script completes successfully, it sets a hidden status code of zero. If the command is unsuccessful, it sets a nonzero hidden status code. This completion status code is known as the exit status. The exit status of the last command or script that was run is contained in the special shell variable, $?.

Most of the time we never look at this value and instead check to see if the command did what we want or look for errors in the output of commands. In a shell script, however, we may want to check the exit status to make sure everything is going OK. The exit status of the last command can be displayed as follows:

$ ls
example1.fil example2.xxx examples test.bsh umask_example.fil
$ echo $?
$ ls *.txt
ls: *.txt: No such file or directory
$ echo $?

The value of the exit code can then be used in a conditional statement or be transferred to another variable.

Easy Linux CommandsFor more tips like this check out my book Easy Linux Commands, only $19.95 from Rampant TechPress.

Buy it now!

linux, unix, linux command, exit status

RAID 5 and Oracle Databases

While researching the effect of RAID 5 disk configuration on Oracle databases I came accrost more than I thought I expected on the topic.

With disk as cheap as it is today there is no reason to ever use RAID 5 on an Oracle database. Even for a database which sees only a moderate amount of updates the performance loss incurred by using RAID 5 is too high. RAID 1 or some combination of RAID 1 and RAID 0 should be used when high availability is required. Database 10g users should also consider allowing Oracle’s new Automatic Storage Management to handle redundancy on un-mirrored disks (or even raw partitions.)

But don’t take my word for it. Here are some opinions from some notable Oracle administrators:

Oracle Database RAID 5
Mark Rittman

No RAID5. Use RAW whenever possible and consider RAID10 or 0+1. RAID 5 can severely affect performance on highly updated databases.

Oracle Database Administration: The Essential Reference
David Kreines & Brian Laskey

RAID-5 is, in fact, very powerful and inexpensive. It is also a technology to be avoided in most cases when configuring your Oracle database! This may seem a harsh statement, but the reality is that although RAID-5 provides good levels of data protection at a low monetary cost, this comes at a very high cost for disk I/O. In particular, write operations on RAID-5 arrays can be orders of magnitude slower than the same operations on a single disk.

Oracle and RAID usage
Mike Ault

Use RAID10 when possible, RAID5 if it is not. Size the array based on IO needs first, then storage capacity and you can’t go wrong.

Disk Management for Oracle
Donald Burleson

Oracle recommends using (SAME) Stripe And Mirror Everywhere (a.k.a., RAID 1+0) for all systems that experience significant updates. This is because of the update penalty with RAID 5 architectures.

Using RAID 5 for a high-update Oracle system can be disastrous to performance, yet many disk vendors continue to push RAID 5 as a viable solution for highly updated systems.

RAID 5 is not recommended for high-update Oracle systems. The performance penalty from the parity checking will clobber Oracle performance.

If you’re still not convinced check out Baarf.com. This site is committed to the Battle Against Any Raid Five (or four or free, uh, three.) The site has links to several more articles exposing the perils of RAID 5.

oracle, rdbms, dba, systems administration, sysadmin, raid, raid 5

We win a Sun T2000!

Sun T2000Well things weren’t quite as easy as Johnathan Schwarts, now CEO of Sun implied when he wrote “if you write a blog that fairly assesses the machine’s performance (positively or negatively), send us a pointer, we’re likely to let you keep the machine.” but after a little extra paperwork and a more formal contest we have won a Sun Fire T2000 server!

That’s right! Thanks to considerable help from Scott Maziarz, an outstanding Plymouth State University IT major who has been working with me on all things Oracle, we were able to evaluate the performance of the Sun Fire T2000 against our existing Sun Fire V440. Scott ran a series of tests based on some jobs we run daily to recreate data marts in our production system.

Scott ran the tests and compiled the results and I wrote up our findings here on Life After Coffee for others to see (and so we could enter the contest.) We ended up shipping our T2000 back as our 60 day trial was over before we were chosen for the contest, but now Sun says they’ll be sending it back to us.

So a big thanks to Scott for his help and to Sun for running this program and choosing us as a winner!

Synergy – Cross Platform Mouse and Keyboard Sharing

SynergyTim Haroutunian recently discovered the open-source, cross-platform utility Synergy which allows you to seamlessly share a keyboard and mouse with several computers of varying platforms.

The behavior of Synergy is similar to having multiple monitors on a single computer with the added advantage that you’re controlling multiple systems. Since I have both a Mac OSX desktop and a Windows laptop on my desk it was nice to reduce myself to one keyboard and mouse! Even clipboard data is shared between the systems.

Setup was a little less than intuitive but well worth it. Out of the box, security is fairly weak, however the Synergy project page does have instructions on how to tunnel Synergy traffic through SSH. Mac, Windows and Linux binaries are available along with the source code for those DIYers.

kvm, cross-platform, software, systems administration, linux, OSX

SSH Without A Password

Zach has posted a good quick reference for setting up SSH to use a shared key for authentication instead of a password on a UNIX system. It’s important to keep your keys secure, but this can allow you to set up scripts to execute commands or move files between multiple hosts without prompting for passwords.

If memory serves this type of authentication is enabled by default on most ssh servers, but if it doesn’t work talk to your sys-admin to see if it is disabled.

unix, linux, solaris, mac osx, osx, ssh, security