Posts Tagged ‘UNIX’

* eclipsed

Posted on March 29th, 2009 by doug. Filed under Solaris, UNIX & Windows, eclipse, shell.


 

 

eclipse splash

 

I’ve been working with Remote System Explorer (RSE), a terminal and ssh session manager that runs in the Eclipse SDK. This is very cool – the thing is, eclipse runs on Solaris, Linux, Windows, MAC OSX, IBM AIX (of course – IBM created the eclipse framework). It as close to an OS-agnostic framework as anything I’ve ever experienced.

I had primarily intended to use it on windows to add ssh terminal capacity – replacing console2 and cygwin – to connect to UNIX servers. But the interface is so good, I find I’m using it on both UNIX and windows – the konsole terminal is better in some ways at history and at cut-and-paste using mouse buttons directly. So far the context menu from a right-click is the only cut-and-paste that functions within the terminal windows themselves.

On the other hand – in konsole each separate terminal window is a separate authentication – password-response – whereas in eclipse RSE, one authentication can be kept and spawn as many terminal sessions as needed. The organization is better. You can close the terminal sessions down, and leave a connection still intact. Then bring back terminal sessions as needed. That ability alone makes it worth losing the double-click select and middle-button paste from konsole sessions. I’m not yet convinced I can’t find a way to get that working either, that and an unlimited history or at least 10000 lines…

 

eclipse window

 

If I can get that back somehow in the terminal sessions it will be not just slightly better, but a huge amount better than any other session management I’ve used.

Install

You need java. On windows that can be an issue. On UNIX, not so much, pretty much there by default.

Download RSE and eclipse SDK.

Untar or unzip the eclipse package. In windows I unzip to c:\eclipse_3.4.2. In UNIX /usr/local/eclipse.

Unzip the RSE package layered over the eclipse install.

In windows I point a shortcut to c:\eclipse_3.4.2. In UNIX I move /usr/local/eclipse to /usr/local/eclipse_3.4.2, and create a symbolic link /usr/local/eclipse -> /usr/local/eclipse_3.4.2.

Open eclipse. Go to window -> open perspective -> other and open Remote System Explorer.

 

eclipse window

 

Configurations are stored in the workspace folder. Right-click in the left-hand pane and select “New Connection to create connections. Within eclipse you can add software respositories and update and add software from Help -> Software Updates.

 

eclipse window

eclipse window

 

 

— doug

 

Tags: , , , , .



* ports and processes in Solaris

Posted on September 24th, 2008 by doug. Filed under Solaris.


 

In Linux, “netstat -apn” will list processes versus ports bound to:


dsm@dali:~$ netstat -apn
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:24800 0.0.0.0:* LISTEN 9353/synergys
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN -
tcp 0 0 172.17.8.76:43003 172.19.235.82:22 ESTABLISHED 4305/ssh
tcp 0 0 172.17.8.76:32852 198.200.144.106:22 ESTABLISHED 13523/ssh
tcp 0 0 172.17.8.76:44173 198.200.144.106:22 ESTABLISHED 13546/ssh
tcp 0 0 172.17.8.76:53463 172.17.85.49:22 ESTABLISHED 28801/ssh
tcp 0 0 172.17.8.76:57385 172.19.230.85:22 ESTABLISHED 5208/ssh

If you want to see, say, all the ssh processes:


dsm@dali:~$ netstat -apn | grep ssh
tcp 0 0 172.17.8.76:43003 172.19.235.82:22 ESTABLISHED 4305/ssh
tcp 0 0 172.17.8.76:32852 198.200.144.106:22 ESTABLISHED 13523/ssh
tcp 0 0 172.17.8.76:44173 198.200.144.106:22 ESTABLISHED 13546/ssh
tcp 0 0 172.17.8.76:53463 172.17.85.49:22 ESTABLISHED 28801/ssh
tcp 0 0 172.17.8.76:57385 172.19.230.85:22 ESTABLISHED 5208/ssh
tcp 0 0 172.17.8.76:58116 172.19.220.114:22 ESTABLISHED 5459/ssh
etc...

On Solaris… On SUN’s Solaris there isn’t an easy way to accomplish the same. On a normal non-containerized server you can run netstat and then lsof…

Assume that you know there is a process conflict – some process has already bound to a port 8083. Your process fails because it can’t bind to the port it needs, that port is already in use – somewhere.

netstat –an | grep 8083 gives you:

[dsm@sun1 bin] $ netstat -an | grep 8083
198.200.144.14.8083 *.* 0 0 49152 0 LISTEN
198.200.144.30.8083 *.* 0 0 49152 0 LISTEN
198.200.144.17.8083 *.* 0 0 49152 0 LISTEN
*.8083 *.* 0 0 49152 0 LISTEN
198.200.144.90.8083 *.* 0 0 49152 0 LISTEN
198.200.144.10.8083 *.* 0 0 49152 0 LISTEN

The *.8083 is our problem child, but we don’t have which process is bound to that port yet.


[dsm@sun1 bin] $ lsof -i:8083
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 1548 jb-1 18u IPv4 0x3005df7be68 0t0 TCP s1q:8083 (LISTEN)
java 6903 appadmin 5u IPv4 0x30070580ae8 0t0 TCP *:8083 (LISTEN)
java 7497 jb-2 9u IPv4 0x300099344d0 0t0 TCP webq1:8083 (LISTEN)
java 7989 jb-3 9u IPv4 0x32af1cd79a8 0t0 TCP ntumq1:8083 (LISTEN)
java 9445 jb-ty 9u IPv4 0x30009925e30 0t0 TCP tyq1:8083 (LISTEN)
java 16369 jb-jun 9u IPv4 0x3007b9a21f0 0t0 TCP rjq1:8083 (LISTEN)
[dsm@sun1 bin] $

Process id 6903 if the villian of this piece in this case.

And this works on servers, but not within containerized servers… On a container you get:


$ lsof -i :8083
lsof: can't stat(/devices): No such file or directory

Basically, a zone within a Solaris10 global zone doesn’t have a /devices directory; so you can’t ! You have to do this from the global zone – not ideal :-|

 

— dsm

 

Tags: , .



* console2…

Posted on August 28th, 2008 by doug. Filed under UNIX & Windows.


 

My ideal workstation to manage UNIX servers is kubuntu, running KDE.

I recently did a day of off-site work. I used a laptop running exactly that environment. I fell back in love with the terminal program Konsole. There are two primary reasons I use KDE instead of Gnome in the desktop wars. Konsole, and the ctrl-n for a new tab window, ctrl-s to name that tab, and shift-left / shift-right to move between windows, and Klipper, the searchable, expandable clipboard utility that by default appears in the system tray. And the select-and-copy, middle mouse button paste default behavior, that too, but that’s not KDE, that’s UNIX itself.

I could use kubuntu for the day because I was NOT expected to access email, nor did I need access to the change management software. I didn’t need access to internal sites that require Internet Explorer. Just for a day I could be a UNIX wonk.

Today, two days later, I’m feeling the loss. I have a linux workstation. From that workstation I have access to the systems I need to work with. What I don’t have is email access, Internet Explorer, access to the change management ticketing system, and on and on. I end up using the Windows XP workstation right next to it out of expediency. I CAN copy and paste data out of the ticketing system. I CAN create Microsoft Project updates. I CAN access the internal Instant Messaging system, I CAN get direct access to email, without switching systems [1]… Windows centric is windows centric.

My taskbar in windows is three labels deep. This is to accommodate the 15 to 25 or more ssh sessions running each in a separate window that appear by the end of each day. Each labeled with the name of the server to which it is connected. Finding a specific window, or in some cases another window to the same server, is a nightmare. I realized today that easily 60% to 80% of the clutter on the taskbar is ssh sessions. I looked out of desperation for KDE to run on windows. It does. Sort of…

A long time ago (2 years?) I found a KDE windows installer that ran on top of cygwin, as long as X11 was fully installed and configured. I got it all working together in a giant balancing act maybe twice. The package for KDE was never updated. The development took off on another direction, the KDE on Windows project. But that brief taste… It was good. Strange, seeing the full KDE desktop running within the Windows desktop. But within that environment I had Konsole, Klipper, multiple desktops.

I’ve been watching KDE on Windows for a while now. I tried it maybe a year ago. The installation process was a number of independent steps, all eerily reminiscent of configuring and recompiling a kernel. I completed about four steps, and determined to wait and watch and see where the project went. I waited. I downloaded and installed a version today – not bad. Once it completed installing I went to look for Konsole… Uh Oh.

Not there?! WTF?

I’m not the only one who wanted this. In searching for Konsole, or a way to install Konsole, I found that Konsole as written is deeply dependent on the whole UNIX X11 environment, and I found console2. Interesting. And after mapping a few hot-keys, I have a very close approximation of Konsole, running in windows. I added C:\cygwin\bin to my path, configured console2 to start with C:\cygwin\bin\bash.exe, and with cygwin providing the ssh binary, I can reduce my taskbar to two labels high instead of three. Very nice.

I still miss an agnostic work environment where provisions are made to make sure UNIX users can do corporate stuff too (imap or pop for email, evolution or web access for calendaring, a browser-based access to tickets, etc.). But this is good coping.

screenshot of console2

 

— dsm

 

 

Synergy… Another path to a solution.

There is a partial solution I’ve been playing around with at home – synergy. This program allows sharing keyboard and mouse between systems. Just put the separate monitors next to one another, assign one system as server and the other or others as secondary, tell it where the monitors are in relation to each other, start the server, connect a client, and go. It copys and syncs the clipboard between systems, which makes it a different approach to solving the same problems.

It does require two separate computers, two separate monitors, and a bit of effort…

return to article

Tags: , , , .



* stupid shell (and UNIX) tricks

Posted on July 29th, 2008 by doug. Filed under shell.


I love using abobe photoshop C2′s automation – especially when resizing a series of images for the web. I would love to run linux entirely – but linux keeps falling short in graphics programs (yes, I use gimp – sorry, but Photoshop is better) and printer drivers – linux still can’t run my Canon Pixma pro 9000 color printer. That and every corporation I do work for has some required program or access method that seems to insist on only running on windows.

That said, while all operating systems suck to some degree, Windows consistently manages to suck more than most. Cygwin supplements Windows pathetic command line with a bash shell and a lot of UNIX functionality.

When you run adobe batch scripting to resize a series of jpg’s and then save them in a different directory as gif files, it insists on writing “copy” in the file name. photograph1.jpg becomes “photograph1 copy.gif”. To remove the ” copy” string, run:

$ for i in *
> do
> mv "$i" "${i/\ copy.gif}".gif
> done

sed and awk

One of the instructors I had in UNIX system administration courses was… How to put this… One brick short of a wall. He was supposed to include sed and awk UNIX commands i the course, and he glossed over them as “something you would never use, trust me”. A couple of years later, when I needed and had to learn the commands, I thoroughly realized he was very wrong.

I had to rename a series of website pages in a site redesign – including altering the names inside the pages themselves. Here’s how I did it.

Here’s the command that changed one set of links from the old page to the new:


for i in ` grep photographs_5.html * | awk -F : '{ print $1 }'`
do
echo $i
sed 's/photographs_5.html/photographs_001.html/g' < $i > $i.1
mv ${i}.1 ${i}
done

This loops through and finds any files with the string “photographs_5.html”

echos out each file, changes (using the sed command, standard UNIX tool…) from photographs_5.html to photographs_001.html, creating a new file named [file].1,

then replacing the original file by moving (mv) the [file].1 file over on top of the [file].

I love UNIX. Both of these were done on Windows using the bash shell in cygwin. This supplies basic UNIX functionality to Windows, including the bash shell, sed and awk, ssh and rsync (by selecting the package), wget and gpg (extra package selection), and many other functions. The setup program downloads a list, within which you can select additional packages, download and install.

Cygwin at least makes Windows somewhat command line friendly.

—dsm

Tags: , , , , .



engineers

recent posts

What I'm Doing...

  • waiting for Dell to inform FedEx they've shipped my netbook... 2010-06-07
  • sorting out stuff (moving...) 2010-05-25
  • downloaded netbook remix (for my Asus) and amd64 (for my 64 bit Intel PC) - desktop for everything else has slowed to 120 kbs... 37 minutes 2010-04-29
  • More updates...

Posting tweet...

categories

archives

tag cloud

apache apache2 bash shell browsers comics compile cygwin data databases daughter eclipse economics engineer entropy finances firefox 3 hallucinations Heinlein internet java jboss KDE linux moinmoin monitoring nagios plugins RSE scifi script Solaris structure subversion support svn testing tweet UNIX UNIX & Windows web hosting website websphere windows WordPress writing

admin