Monday 12 August 2013

How do I remove the carriage return from an echo on Solaris?

Solaris "echo" doesn't know about the -n switch, try it and see:

# echo -n test
-n test
#

To get the right behaviour you need "\c", which you use like this:

# echo "test \c"
test #

Sunday 11 August 2013

How can I verify that I'm at run level 5 in Solaris?

Firstly, "init 5" on Solaris is a shutdown command. The nearest equivalent to the Linux run level 5 you may be familiar with is "init 3".

Secondly, you can see what run level you're currently at with the handy "who -r" command.

What's the equivalent of Kickstart on Solaris?

It's called Jumpstart, and it's ace, especially when used in combination with Flash archives (sort of the Solaris equivalent of Ghost images).

Where do the run control scripts live on Solaris 10+?

Rather depressingly, Sun decided to "improve" on the old Unix system of placing start and stop scripts in "/etc/init.d" and "/etc/rc*.d". Those directories are retained for legacy purposes, but virtually everything is now controlled by the Service Management Facility. There's an introductory article from Oracle available here but the commands you really need to know about are "svcs" and "svcadm".

If anyone is aware of a good reason for SMF to exist, please do share it.

How do I get ps to give me full details of a process on Solaris?

Rather annoyingly, Solaris "ps" truncates the command line arguments passed to a process at 80 characters.

However, as compensation it does provide the "pargs" command instead. Simply run "pargs PID" to get everything.

Saturday 10 August 2013

Is Solaris good for my career?

Short answer: Yes.

Long answer: I would rate Solaris on SPARC as one of the premium operating systems a sysadmin can work on. Others I would include in the same bracket are AIX and Red Hat.

One rung down the ladder but still perfectly respectable are HP-UX, Solaris on x64, SuSE and (God forbid) Oracle Linux.

Be careful about Debian, CentOS or Ubuntu. These are nice enough in themselves but not really suitable for enterprise use (which means most big companies won't care if you're experienced with them). I know some corporations do use these distros, because they don't need to pay maintenance or licensing costs, but I don't think it's a great idea not to have vendor support. In the event of a big outage you have no safety net.

Obscure Linux distros and defunct Unix versions should be avoided unless you're aiming to corner a niche. It is, however, worth spending a small proportion of your time working with The Great Satan (aka Windows), if only because so many UNIX/Linux roles do require some Windows work. Sad but true.

How do I grep recursively on Solaris?

The old-fashioned way.

You won't get much joy running "grep -r" on SunOS, but our forefathers got by just fine with:

# find . -type f | while read file
> do
> echo $file
> grep WHATEVERYOULIKE $file
> done

This is not terribly efficient, but luckily modern SPARC processors have advanced considerably, even if modern Solaris "grep" has not.