Thursday, November 19, 2009

Get application pid listening on a network port in Solaris (aka netstat -npl in Solaris?)

Source link


#!/bin/bash

# Get the process which listens on port

# $1 is the port we are looking for

if [ $# -lt 1 ]; then
echo "Please provide a port number parameter for this script"
echo "e.g. $0 22"
exit
fi

echo "Greping for your port, please be patient (CTRL+C breaks) ... "

for i in `ls /proc` ; do
pfiles $i | grep AF_INET | grep $1
if [ $? -eq 0 ] ; then
echo Is owned by pid $i
fi
done


To research: In comments to the original post somebody offers to use lsof.

Wednesday, November 18, 2009

How do I know my global zone nodename from a non-global zone ?

That's what I found on the Web.

For Solaris Zones, the method I use is the one devised by Menno Lageman (http://blogs.sun.com/menno). Mount the global zone's /etc/nodename using a read-only LOFS mount on /etc/chassis in the non-global zone. It automatically changes whenever the nodename of the global zone changes, whether it is because the name of the global zone is modified or because the zone is moved to another physical host using zoneadm detach/attach. Just do this:


# zonecfg -z zone

zonecfg:zone> add fs

zonecfg:zone:fs> set dir=/etc/chassis

zonecfg:zone:fs> set special=/etc/nodename

zonecfg:zone:fs> set type=lofs

zonecfg:zone:fs> add options ro

zonecfg:zone:fs> end


Taken from here:
http://blogs.sun.com/apatoki/entry/how_do_i_know_my

I did not try this yet, I have no appropriate Solaris box by hand. But that could be useful.

Wednesday, September 30, 2009

NTFS and Solaris

Derek Crudgington in his blog reported about read support for NTFS in Solaris 10:

# wget http://www.belenix.org/binfiles/FSWpart.tar.gz
# wget http://www.belenix.org/binfiles/FSWfsmisc.tar.gz

Untar them, pkgadd them, and you are done. Then simply:

# mount -F ntfs /dev/dsk/c0d0pX /mnt

And nice command to view partitions:

# prtpart /dev/rdisk/c0d0p0 -ldevs

Very good news.

Thursday, September 17, 2009

Introduction

I'm going to use this blog to make some notes mainly about Solaris (and UNIX generally). No idea, if it makes sense, but it least it would be easy to me to keep and share my knowledge.

I'm not going to write articles or make any scientific research. From time to time I just run into the problem, or question, or whatever. Then I'm starting to look for the answer and if I got it, I prefer to have it at hand. That's why I'm starting this blog; among other things, I hope records will be indexed by search engines and probably could help somebody who would run into the same problem. But I'm not going to promote the blog.

Any comments either regarding the subject or English are very appreciated.