Friday Nov 27, 2009
(This blog entry is my German translation of my original blog entry on Sun Ray and ZFS at JavaOne 2009)
Was passieren kann, wenn man zwei beeindruckende Technologien auf intelligente Weise kombiniert, konnte man in diesem Jahr auf der JavaOne-Konferenz beobachten: Mehrere tausend Desktop-Umgebungen wurden mit einer Kombination aus Sun VDI Software 3, ZFS, Sun-Servern and Sun-Speichersystemen dargestellt. Hier einige bemerkenswerte Fakten: Es gab nur drei (statt mehrere tausend) verschiedene Betriebssystem-Installationen (Windows 7, Ubuntu 8.10 und OpenSolaris 2009.06)! Alle weitere Installationen waren nur Referenzen auf die originalen drei Installationen, deren Speicherplatz nur dann wuchs, wenn Benutzer ihren Desktop benutzten und Daten veränderten. Erreicht wurde das durch die spezifischen Copy-on-Write- und Snapshot-Eigenschaften von ZFS, wodurch das Klonen der Betriebssysteme nur einen Bruchteil des Speicherplatzes und auch nur einen Bruchteil der Zeit benötigte wie beim üblicherweise nötigen mehrfachen Kopieren der Betriebssysteme. Der gesamte Bedarf an Festplatten-Speicherplatz für die 6000 im Verlauf der JavaOne-Konferenz benutzten Betriebsysteme (jedes ca. 10 GB groß) sank dadurch von gewaltigen 60 TB auf gerade einmal 2 TB!
Nicht mehr als 200 Desktops auf etwas mehr als 150 Sun Ray-Terminals (400 bis 500 wären mit der dort eingesetzten Server-Infrastruktur möglich gewesen) wurden zu einer bestimmten Zeit gleichzeitig benutzt. Alle weiteren, inaktiven Desktops wurden in der Zwischenzeit zentral auf dem Festplattensystem gespeichert. Wie immer bei Sun Rays konnten die Benutzer ihre Java Card (die gleichzeitig auch ihre Konferenzkarte war) aus einem Terminal herausnehmen und zu einer beliebigen Zeit wieder in ein anderes Terminal hineinstecken, um kurz darauf ihre letzte Benutzerumgebung mit unverändertem Zustand am neuen Ort verwenden zu können. Eine Administration von PCs war natürlich durch die Verwendung von Sun Rays anstelle von PCs auch nicht erforderlich.
Wenn man an Schulen und Universitäten denkt, bei denen ebenfalls in vielen Fällen eine relativ geringe Zahl von Benutzern aus einer großen Anzahl von registrierten Benutzern gleichzeitig zu einer bestimmten Zeit ihre Desktops benutzt (z.B. in einem Informatik- oder PC-Lehrsaal), erscheint die auf der JavaOne 2009 eingesetzte SunRay-Lösung hervorragend für solche Umgebungen zu passen.
Auf dieser Internet-Seite (in englischer Sprache) kann man im zweiten Blog-Eintrag (bitte eine Seite nach unten blättern) die wesentlichen Eigenschaften dieser Lösung in einer Liste nachlesen.
Wenn Sie erfahren möchten, was Microsoft über die im eigenen Hause eingesetzte Sun Ray-Umgebung mitzuteilen hat, lesen Sie bitte in meinem letzten Blog-Eintrag nach.
Friday Nov 27, 2009
(This blog entry is my German translation of my original blog entry on Microsoft using Sun Ray at the EEC)
Kürzlich bin ich auf eine interessante Internetseite gestoßen sowie auf einen Blog-Eintrag des EEC (das Enterprise Engineering Center von Microsoft in Redmond im US-Bundestaat Washington). Dort werden bei Bedarf Kundenumgebungen aufgebaut und aktuelle Microsoft-Software-Lösungen sowie deren Interoperabilität getestet. Es ist beeindruckend zu lesen, wie die Sun Ray-Technologie genau auf diese Anforderungen zugeschnitten zu sein scheint. Ein Microsoft-Dokument (in englischer Sprache) beschreibt den Ablauf und die dafür eingesetzte Technik: Bevor der Kunde in das EEC kommt, wird die Kundenumgebung mit Hilfe von virtuellen Maschinen reproduziert. Wenn die Mitarbeiter des Kunden schließlich im EEC eintreffen, erhalten sie Sun Ray-Karten, können sich damit auf beliebigen Sun Ray-Terminals anmelden (bekommen daraufhin ihre eigene Windows-Umgebung angezeigt) und können testen, wie sich eine neue Microsoft-Lösung in der bisherigen Kundenumgebung verhält.
Wie üblich, können die Anwender natürlich jederzeit ihre Karte aus dem Terminal herausnehmen und zu einer anderen Zeit in ein anderes Terminal wieder einstecken und die Arbeit mit denselben Daten, demselben Desktop und denselben Programmen fortsetzen - weil die Sitzung komplett auf dem zentralen Server läuft. Die Sun Ray-Terminals sind nicht viel mehr als eine Grafikkarte und ein Monitor und dienen ausschließlich zur Anzeige der auf dem Server ablaufenden Benutzerumgebung. Außerdem kann kein Kunde auf die Daten eines anderen Kunden zugreifen - selbst der Diebstahl eines Terminals bedeutet keinerlei Sicherheitsrisiko für den Kunden oder für Microsoft. In den Worten von Microsoft (Übersetzung von mir): "Sun Ray thin clients sind von Grund auf für sicheren Betrieb entwickelt worden (was einer der Gründe dafür ist, dass diese in Regierungs- und Militärdienststellen so weit verbreitet sind)".
Hinzu kommt, dass Microsoft durch die im ECC eingesetzte Sun Ray-Lösung Zeit für die Vorbereitung der Kundebesuche und auch Energie einspart (da keine PCs konfiguriert und benutzt werden müssen). Außerdem sind die Sun Ray-Terminals weniger komplex als PCs und sind daher auch deutlich zuverlässiger.
Weitere Informationen über die Sun Ray-Technologie kann man z.B. hier nachlesen.
Friday Nov 27, 2009
This is what can happen if two great technologies are brought together: During this year's JavaOne back in June 2009, several thousand user desktops were handled by a combination of Sun VDI Software 3, ZFS, Sun Servers and Storage. Let me tell you about some remarkable aspects of that setup: There were just three (not thousands of) different operating system images (Windows 7, Ubuntu 8.10, OpenSolaris 2009.06). All other operating system desktops were just references to the original three images, growing only when a user changes data. See how ZFS comes into play? With its built-in copy-on-write and snapshot capabilities, cloning desktops requires just a fraction of the space and time required by traditional solutions. The total amount of storage for the 6000 desktops (each about 10 GB in size) used during the conference was just 2 TB instead of the otherwise needed 60 TB!
There were at most 200 desktops (400 to 500 were possible with that specific setup) in use at any given time, from about 150 Sun Ray terminals. All other (inactive) desktops were stored on disk in the meantime. As always with Sun Ray, users could take their Java Card (which was also their conference card) out of the current Sun Ray terminal and put it back to any other Sun Ray terminal later and would see the exact desktop they used last time. And, of course, no front end administration is necessary with Sun Rays.
Thinking of schools or universities, where often a limited number of users from a much higher number of total users access their desktops at any given time, the Sun Ray setup used at JavaOne 2009 looks like a perfect fit for those environments as well. In the second blog entry on this page (scroll down one page to get to the entry named "VDI 3 @ JavaOne - Summary"), you can see the the main features in one list.
Read what Microsoft says about their Sun Ray solution in my previous blog entry.
Tuesday Nov 24, 2009
Just recently, I read on this web page and also in this EEC blog entry (both published in July 2009) about Microsoft using Sun Ray thin clients in their Enterprise Engineering Center (EEC) in Redmond, WA, where Microsoft is reproducing customer environments and performing product validation. It is absolutely stunning how the specific advantages of our Sun Ray technology fit perfectly into this environment. A Microsoft white paper describes how it all works: In preparation of a customer visit, Microsoft engineers set up virtual machines to rebuild a certain customer setup. When the customer arrives, they just get the Sun Ray smart cards, log in at any Sun Ray client and get their specific (Windows) environment displayed.
As always with Sun Ray, users can take their smart card off one Sun Ray station at any time, plug it into any other one, and continue their work from the new seat, with their data, their desktop contents, and their applications unchanged - because all is stored and running on the remote server. No data of one customer is stored on any client (the client is not much more than a graphics card and a monitor), so no customer will be able to access data from any other customer. As the Microsoft white paper says, "Sun Ray thin clients are designed for secure operation from the ground up (which is one reason they are so widely deployed in government and military agencies)".
Besides that, the Sun Ray solution saves time for the preparation and also electrical energy (as no PC clients have to be configured or used). And because the Sun Ray clients are less complex than PCs, they are also more reliable.
For more information on the Sun Ray technology, please visit this web page. I suggest that you also watch the videos so you can see how it all works in real life.
Wednesday Nov 04, 2009
Recently, I discovered a way to switch between tasks inside a WTS or VNC session (same as <cmd><tab> with native OS X applications): Just replace the <cmd> key by the <alt> key, and you can switch applications inside the WTS or VNC session just as you would do if you were directly logged in to those systems.
Wednesday Nov 04, 2009
Sometimes, I'd like to know which profile I am using with my current Firefox instance (for example if an instance has been open for a long time, or if I'm running two instances (using firefox -P -no-remote) at the same time.
I found the solution on this web site:
Start Tools->Error Console (or press <ctrl><shift>j)
Then, in the Code line at the top (you can jump to it using <ctrl>o), enter the following code and press Return (or click the "Evaluate" button):
alert(Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile).path);
It will show the full path of your profile in a popup window. The name of the profile is the last string after the last dot.
Monday Nov 02, 2009
As mentioned earlier, I am using rsync to copy complete directory trees:
$ cd /source_dir
$ rsync -avz . /dest_dir
It will copy all files, including hidden ones, in directory /source_dir, into the destination directory /dest_dir. In case /dest_dir does not already exist, rsync will create it (at least on my Nevada 72 system).
There may be cases where rsync does not work correctly, for example when there are very long file names. Good to know that there's another easy way to do it:
$ cd /source_dir
$ find . -print -depth | cpio -pdm /dest_dir
The -depth parameter makes find print file names first, and -pdm with cpio means (from man cpio):
-p: reads a list of file path names from stdio and copies those files to the destination tree.
-d: creates directories if necessary
-m: keep file modification times
Destination directory /dest_dir must exist before starting the above commands.
Monday Nov 02, 2009
The following OpenSolaris page contains all download links for Firefox 3.6b1, 3.5.5, and 3.0.15, Thunderbird 3.0b4 and 2.0.0.23, and Seamonkey 2.0b1 on OpenSolaris and Solaris 10:
http://hub.opensolaris.org/bin/view/Community+Group+desktop/development
You can still find Firefox 2.0.0.20 linked here:
http://blogs.sun.com/blogfinger/entry/firefox_for_solaris_latest_versions2
You can also browse all Firefox versions for all platforms here:
http://releases.mozilla.org/pub/mozilla.org/firefox/releases/
And the latest Acrobat Reader (current version is 9.2) for OpenSolaris is - as always - available via the following page:
http://get.adobe.com/reader/otherversions/
Friday Jul 10, 2009
These are the direct links for downloading Firefox 3.5 for Solaris:
You can still find the links to the latest Firefox 2 version (2.0.0.20) in this blog entry, and to Firefox 3.0 in this blog entry.
If you are visiting the Mozilla web site from a Solaris system, your system will be automatically detected, and you can a see link which shows "Download Firefox - Free" and "3.5 for SunOS". That link directs you to the Mozilla development page on OpenSolaris.org. Unfortunately, the Solaris versions are not yet mentioned on the "Other Systems and Languages" web page (actually, that's why I am maintaining the Firefox for Solaris links in my blog), but who knows - maybe we'll see it there in a while.
Friday Jul 10, 2009
These are the direct links for downloading the latest versions of Firefox 3 for Solaris:
You can still find the links to the latest Firefox 2 version (2.0.0.20) in this blog entry.
If you would like to install multiple versions of Firefox on your Solaris system, you can use the tarballs or my script for renaming a Firefox package.
Oh - and if you are running Solaris or OpenSolaris on x86, I suggest to install the recently released Adobe Reader 9.1 for Solaris x86!
Wednesday Apr 01, 2009
These are the direct links for downloading the latest versions of Firefox 3 for Solaris:
You can still find the links to the latest Firefox 2 version (2.0.0.20) in this blog entry.
If you would like to install multiple versions of Firefox on your Solaris system, you can use the tarballs or my script for renaming a Firefox package.
Oh - and if you are running Solaris or OpenSolaris on x86, I suggest to install the recently released Adobe Reader 9.1 for Solaris x86!
Thursday Mar 26, 2009
Believe it or not. Adobe has finished and made available Adobe Reader 9 for Solaris x86! You can download it from here (in .bin (self-extracting executable), .tar, and .pkg format). System requirements are mentioned here (minimum Solaris level are s10u5 or OpenSolaris 2008.11).
Thursday Mar 26, 2009
Recently, I encountered an article on Heise Security (for the English version, click here) and found it very useful. The article recommended to change the property browser.identity.ssl_domain_display from 0 to 1 in about:config so that the area in which the favicon is displayed (left to the URL line) will also display the domain name. The change will make it much easier to identify a secure web sit before entering personal or otherwise sensitive information like passwords, so I also recommend it. You can find screen shots at the bottom of the mentioned article.
Thursday Mar 05, 2009
These are the direct links for downloading the latest versions of Firefox 3 for Solaris. Because there are several security bug fixes implemented in 3.0.7, I strongly recommend to install them soon:
You can still find the links to the latest Firefox 2 version (2.0.0.20) in my previous blog entry on Firefox versions for Solaris.
If you would like to install multiple versions of Firefox on your Solaris system, you can use the tarballs or my script for renaming a Firefox package.
Monday Feb 09, 2009
Recently, I encountered the rsync man page by accident (maybe as one of the lines in the top 10 Google search results?) and was quite surprised to find rsync examples where there was no remote host in any of its arguments. Doesn't rsync stand for something like "remote synchronization"?
So here's how it works:
If you want to copy all files in a directory and all directories and files below to another directory (for example on another file system on a different disk), use the following command:
$ rsync -avz /source_dir/ /dest_dir
Note the added slash after /source_dir. This command will recursively copy all files and directories in directory /source_dir to directory /dest_dir (will create it if it doesn't exist). If you omit the trailing slash, it will create a new directory /dest_dir/source_dir. The rsync command will copy links as links, not as the original files they point to (similar to the default behavior of Solaris or GNU tar). If the rsync command was run before at least once, it will copy only the changed or newly added files. It will not remove destination files if files have been removed in the source directory.
Example: Copy all directories and files in directory /tmp/1 to empty directory /tmp/2:
Monday Feb 09, 2009
These are the direct links for downloading the latest versions of Firefox for Solaris:
Note that you can easily install multiple version of Firefox on Solaris, using either the tarballs or my script for renaming a Firefox package.
Wednesday Feb 04, 2009
Good news: You can save a lot of money easily! Here's how it works:
Go to http://www.fueleconomy.gov/mpg/MPG.do?action=browseList (for the US or Canada) or http://www.spritmonitor.de (for Europe) or a similar site where car drivers can enter data of their cars and their tank fillings. Search for similar cars like yours (same engine/power/cylinder capacity, same year of manufacture), look for the average and also for the lowest fuel consumption of these cars (maybe also for the highest).
Let's take the 2004 Toyota Prius. The average range is 46.3 mpg but the best is 62 mpg! Even if you do are not the perfect eco driver, you might be able to achieve 60 miles per gallon.
Suppose you are typically driving 20,000 miles a year. That's 20,000/46.3 = 432 gallons of fuel for the average 2008 Prius. Now let us do the same calculation for the fuel efficient driver: 20,000/60 = 333.3 gallons. Considering a price of 1.7 US $ per gallon, that's about $165 less (870.5 kg less CO2) per year. Not too bad!
What about the 2004 Ford F150 Pickup 2WD 8 cyl 5.4 L? Average mpg is 15.3, worst is 12 and best is 19 mpg. For 20,000 miles a year, that would be 20,000/15.3 = 1,307.2 gallons in average or 1,052.6 for the best driver. Difference is more than $432, so you should be able to save more than $400 (2.25 metric tons CO2) per year (and even more if you are used to driving at high speed and/or with too low air pressure in your tires, or if you use your car instead of your bike for getting fresh rolls in the morning)! For just a fraction of the saved money, you could buy a good computer racing game. Or do indoor cart racing once a year.
For those of you living in Europe, you will save even more (as fuel prices are a lot higher than in the U.S.). In my case, for about 20,000 km (12,427 mi) per year on a Toyota Corolla Combi 1.6 (station wagon), I achieved 5.7 liters per 100 km (41 mpg) in average, compared to 7.5 liters per 100 km (31.4 mpg) for the average driver. With a fuel price of 1.39 EUR per liter (5.25 EUR per gallon), I saved about 500 EUR (and more than 800 kg CO2) per year compared to the average driver, or twice as much compared to a driver that prefers an F1 driving style.
And this is the "car" I am using for short distances, including shopping in my home village - saved me another 100 EUR (plus the fitness center fees) and 160 kg CO2 per year:

Tuesday Jan 27, 2009
Inspired by this and then this blog entry, I thought it was now time for me to get my own experience with iSCSI.
Here's the result:
- On my eco-friendly server running OpenSolaris 2008.11, I created a new ZFS volume (not a ZFS file system!) with iSCSI sharing switched on:
$ zfs create -o shareiscsi=on -V 180G pool2/mac-tm
cannot share 'pool2/mac-tm': iscsitgtd failed request to share
filesystem successfully created, but not shared
- Well, that did not work well. Better search and install the iSCSI packages first:
$ pkg search -rl iscsi | nawk '{print $NF}' | \
nawk 'BEGIN{FS="@"}{print $1}' | sort -u
PACKAGE
pkg:/SUNWiscsi
pkg:/SUNWiscsitgt
$ pkg install SUNWiscsi SUNWiscsitgt
DOWNLOAD PKGS FILES XFER (MB)
Completed 2/2 18/18 0.86/0.86
PHASE ACTIONS
Install Phase 74/74
PHASE ITEMS
Reading Existing Index 9/9
Indexing Packages 2/2
- Then, I wanted to delete (destroy, in ZFS speak) and create the zvol again:
$ zfs destroy pool2/mac-tm
cannot destroy 'pool2/mac-tm': volume has children
use '-r' to destroy the following datasets:
pool2/mac-tm@zfs-auto-snap:frequent-2009-01-23-12:15#
- OK, I understand that an automated snapshot had already been created in the meantime. Destroy the zvol with its snapshots, and create the zvol again:
$ zfs destroy -r pool2/mac-tm
$ zfs create -o shareiscsi=on -V 180G pool2/mac-tm
- Check if the shareiscsi property is on for our volume:
$ zfs get shareiscsi pool2/mac-tm
NAME PROPERTY VALUE SOURCE
pool2/mac-tm shareiscsi on local
- List all defined iSCSI targets:
$ iscsitadm list target
Target: pool2/mac-tm
iSCSI Name: iqn.1986-03.com.sun:02:3f4f551a-41ab-4a3a-adf9-ea3ce5c2789c
Connections: 0
- Looks great! On the MacBook Pro running Mac OS X 10.5.6, I installed the globalSAN iSCSI initiator software (version 3.3.0.43) from Studio Network Solutions, after downloading from this link.
- Then I rebooted the Mac (as required by the globalSAN iSCSI software).
- Next step was to mount the iSCSI drive:

a) Click on the globalSAN iSCSI icon to display its control panel:

b) Click on the + symbol in the lower left corner to get the following popup:

c) Enter the IP address or host name of the OpenSolaris server, leave the port number as it is, and enter the target name (the last column in the line starting with iSCSI Name: in the output of the iscsitadm list target command on your OpenSolaris server - in our case, it's iqn.1986-03.com.sun:02:3f4f551a-41ab-4a3a-adf9-ea3ce5c2789c ), and press the OK button. The iSCSI control panel will then look like:

d) Click the Connected switch at the end of the iSCSI target line (the line which starts with iqn) to get the following popup:

e) Press the Connect button to connect to that iSCSI target. As we did not specify CHAP or Kerberos authentication, the connect will work without user and password. For a walkthrough and more on CHAP authentication, click this link.
After pressing the Connect button, the control panel will look like:

At this time, the newly created volume will show up in Disk Utility. Note that I clicked on the Persistent button to build the connection again after a reboot - I didn't try rebooting to check, but believe it will work.
- Then, I created a Mac OS X volume in Disk Utility.

a) Click on the disk drive and then on the Erase tab, enter a new name for the volume (or leave it as it is), and press the Erase... button. The following screen will displayed to show the progesss:

After the erase is completed, the new volume will show up in the left part of the Disk Utility (For this screen shot, I created the volume again after providing the name ZFS-180GB for the volume. Not sure if it's possible to rename a volume without formatting it):

- Now the volume is usable in Time Machine.
a) Click on the Time Machine icon in System Preferences to start its control panel:

b) Click on Change Disk to change the destination volume for Time Machine (the lock in the lower left corner has to be unlocked first to allow for the change):

c) Select the new volume and press Use for Backup. Then, just start the backup (or wait 120 seconds until it starts automatically):

Mac OS X Time Machine has started its first backup on a ZFS volume!
However, as always in my blog entries, this is no guarantee that it
will always work as described, or that the backup and restore will also
work after your next Mac OS X upgrade, or that there will be no errors
or problems with such a setup. What I can tell you is that a simple
restore attempt worked for me just as if I had done it from a USB disk!
Up to now, I have always disconnected the USB disk drive before closing
the Mac's lid so that a Time Machine backup would not be interrupted in
the middle. Not sure what would happen if a Time Machine backup is
running while you close the lid, so better read the docs and test it, or just always
unmount Time Machine's active volume before letting your Mac sleep.
And I discovered that if an iSCSI volume is mounted before closing the lid, the Mac Book Pro cannot transition into deep sleep mode with a power consumption similar to the switched off state. It somehow sleeps, but with rotating fan and a steady front LED. And in order to wake it up, I had to open and close the lid several times. So the steps to do before closing the Mac's lid are:
- Eject (unmount) the volume (use the eject menu item after right-clicking on the volume's icon on the desktop).
- Disconnect the iSCSI target (and all others) in the globalSAN iSCSI control panel in the Mac OS X System Preferences, by unmarking the tick in column Connected for all targets. A confirmation popup will be shown when unmarking the Connected tick.
After waking up your Mac next time, just tick the Connected mark in the globalSAN iSCSI control panel again and confirm the popup that will be shown. If you did not choose another destination disk for Time Machine in the meantime, Time Machine will recognize the iSCSI drive as a valid destination volume automatically and use it for its next scheduled backup.
BTW For an interesting article on how to use ZFS iSCSI sharing with a Linux client, please click here.
Friday Jan 23, 2009
Using DTrace's destructive actions, you can perform actions on your operating system you never thought of before, like backup files with a zfs snapshot right before a user deletes them, or halt any process before it is ended.
With the help of the files in directory /usr/demo/dtrace, the DTrace Toolkit, and my colleagues who showed me the best probe for intervening before a process is really ended, I wrote and tested the following short DTrace script to halt certain processes before they are ended. It can be very useful if you encounter a large number of short-lived processes which you could not analyze otherwise. In the following example, we are looking only for processes running with userid 4 (username adm) and with the executable name date. I saved it as file name stopper.d.
#!/usr/sbin/dtrace -ws
syscall::rexit:entry
/(execname == "date") && uid == 4/
{
printf ("%d(%d): %d %d %d %d, %s, >%s<: %Y", pid, ppid, uid,
curpsinfo->pr_projid, curpsinfo->pr_zoneid,
curpsinfo->pr_dmodel, cwd, curpsinfo->pr_psargs, walltimestamp);
/* stack(); */
/* ustack(); */
/* system ("pmap -x %d", pid); */
printf ("\nStopping Process %d ...", pid);
stop();
printf (" done.");
system ("ps -eo user,pid,ppid,s,zone,projid,pri,class,nice,args | nawk '$2==\"%d\"{print}'", pid);
}
Be warned! Adapt the filter rules carefully on a test system before using the script on the system on which you want to halt processes! Use the script on your own risk - I cannot guarantee for anything!
For listing the stopped processes, you can use the following command:
$ ps -eo user,pid,ppid,s,zone,projid,pri,class,nice,args | \
nawk '$4=="T" && /date/{print}'
And for ending these stopped processes, you can use that one:
$ ps -eo user,pid,ppid,s,zone,projid,pri,class,nice,args | \
nawk '$4=="T" && /date/{system ("kill -9 "$2)}'
For testing, I created a script named start-50-date-processes.ksh to start 50 date processes roughly at the same time, then started the DTrace script above as user root:
./stopper.d
and afterwards started the test script as user
adm:
./start-50-date-processes.ksh
A sample output looks like:
$ ./stopper.d
dtrace: script './stopper.d' matched 1 probe
dtrace: allowing destructive actions
CPU ID FUNCTION:NAME
1 3413 rexit:entry 21922(5058): 4 3 0 1, /var/adm/bin, >date<: 2009 Jan 23 13:47:37
Stopping Process 21922 ... done.
adm 21922 5058 T global 3 57 IA 24 date
1 3413 rexit:entry 22005(5058): 4 3 0 1, /var/adm/bin, >date<: 2009 Jan 23 13:47:41
Stopping Process 22005 ... done.
adm 22005 5058 T global 3 47 IA 24 date
0 3413 rexit:entry 22090(22089): 4 3 0 1, /var/adm/bin, >date<: 2009 Jan 23 13:47:56
Stopping Process 22090 ... done.
adm 22090 1 T global 3 44 IA 20 date
... (some more lines)
For stopping the DTrace script, just press <ctrl>c in the window where you started it. Stopping the script will not let the stopped processes continue - they remain in the "T" (for Trace) status until they are killed.
The DTrace script will run faster if you comment out its last line (where it executes the ps command for each stopped process).
And here's the test script (for starting 50 date processes) which I executed as user adm:
$ cat start-50-date-processes.ksh
#!/bin/ksh
i=50
while [[ i -gt 0 ]]; do
date &
(( i = i - 1 ))
# or (( i-- )) with ksh93 on Solaris 10, or OpenSolaris
done
Wednesday Jan 21, 2009
I think some of you will find the following (n)awk one-liner useful. I am using it from time to time and thought I should document it so that I do not have to think about where to place the "a++" part, for example.
It will print out lines of a file that match a certain pattern, plus some more lines that follow. In this example, I am searching for lines that contain the string "usb" in /var/adm/messages, and print that line plus 4 more (for more lines, decrement the number in the first curly brackets accordingly). A line number will also be printed out for each line:
$ nawk '/usb/{a=-5}{if (a<0){print NR, $0};a++}' /var/adm/messages