Note to Self: Solaris != Linux

At home, I have 4 machines that run Linux and one that runs Solaris 10. The Sun Ultra60 running Solaris 10 is my primary workstation for day-to-day stuff. However, sometimes if I’m fresh from doing some admin work on one of my Linux machines, I’ll sometimes forget the subtle differences between Solaris and Linux. This is one example of the havoc this can wreak:

In Linux, to send a process a signal by name (instead of by PID) one can use the “killall” command. The name signifies that it “kills all” processes whose name matches the pattern specified. This is a lot more handy than using the kill command and having to pgrep for a PID every time. I get used to doing this in Linux a lot since runaway processes like failed backup jobs need to be killed. I don’t usually have to send signals to processes on my Solaris box since it rarely has anything hang.

There is, in Solaris, a command that’s analogous to Linux’s “killall.” It’s called “pkill” and works pretty much the same. There’s also a command in Solaris called “killall.” It, however, is NOT analogous to Linux’s “killall” command. It’s actually a script that Solaris’s “shutdown” command calls to send SIGTERM and then SIGKILL to all the system’s processes as the last step in halting execution of the OS. In a root shell in Solaris, typing “killall -TERM gnome-session” DOESN’T terminate your Gnome desktop session. It terminates EVERY PROCESS ON THE SYSTEM and kicks you out to firmware. The OS then bitches at you at next startup for leaving unclosed named pipes and socket files laying around.

Advertisements
  1. #1 by Andrew D. on December 7, 2009 - 11:39 PM

    Nice.

    I got used to using “kill `pidof processname`” on systems that didn’t have killall (backticks are important). Killall is such a nice tool.

    • #2 by Joshua on December 8, 2009 - 7:31 AM

      UglyDuckling% ksh
      $ pidof
      ksh: pidof:  not found
      $
      

      pidof is a BSD-origin command. SysV systems like Solaris, HP-UX, AIX, Tru64, SCO, etc. have no use for such sissy things as BSD commands. 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: