Unix

Kill running process in a Unix-based console with the example of the Java Web Server Grizzly

1. Step: We need to find the proper running process in the background, for that we will use the command...


ps aux

... which lists all running processes which mostly is too long of a list:


jurgen 39191 0.0 0.8 904472 69368 ?? S 2:19PM 0:11.78 /Applications/Google Chrome
jurgen 39043 0.0 0.2 2524472 13976 ?? Ss 9:51AM 0:02.62 com.apple.security.pboxd
jurgen 38473 0.0 0.0 2467260 432 ?? Ss Tue03PM 0:00.20 com.apple.XType.FontHelper
...

So we filter out only the process that we are looking for, by using the command 'grep' and using the console pipe '|' to concatenate the commands


ps aux | grep java

Result:

jurgen 39543 0.1 1.9 4845420 163316 s008 S+ 5:49PM 0:07.18 /Library/Java/JavaVirtu... exec:java
jurgen 39573 0.0 0.0 2432768 460 s007 S+ 6:08PM 0:00.00 grep java

Now this returns us the proper process but also the 'grep' process itself which we were just running in our pipe, to filter this, we concatenate yet another 'grep -v grep':


ps aux | grep java | grep -v grep

... and we only get the process we need

jurgen 39543 0.1 1.9 4845420 163316 s008 S+ 5:49PM 0:07.18 /Library/Java/JavaVirtu... exec:java

Now that we have identified our process with its process number 39543 (second column in our process), we can terminate it with the 'kill -9'* command, as follows:


kill -9 39543

* If your wondering: The -9 parameter tells the kill-Command to send a SIGKILL signal to our process

In conclusion the following - more generic code - needs to be executed:

ps aux | grep [server_process_name] | grep -v grep
kill -9 [identified_process_id]

Taggings:

Making a Unix server graphic based

One way to solve this problem, is to directly install a desktop package by using the command line.

sudo apt-get install ubuntu-desktop

This can also go well, but by experience, most of the time, it is better to work within an interface for system administration for Unix. This interface can be provided by Webmin, which is web-based. How to prepare the system and install webmin can be found here: http://www.webmin.com/

Taggings:

Use GeoCouch as a secondary index

There exists a plugin for CouchDB called GeoCouch, which can be used to issue very basic geospatial queries against the database. With this plugin you can formulate queries based on locations and bounding boxes. For example: "give me all the restaurants in a certain (rectangular) area".
This is possible because GeoCouch uses a different indexing system than CouchDB internally.

Using this plugin we can represent the time interval we're interested in as a 1 dimensional bounding box around the document start dates.

view definition:

function(doc)
{
if(doc.begin && doc.end)
{
//start and end time as UNIX timestamps (seconds, not milliseconds)
var begin = Math.round(new Date(doc.begin).getTime()/1000);
var end = Math.round(new Date(doc.end).getTime()/1000);
emit(
{
type: "Point",
bbox : [0,start,0,end]
}, null
);
}
}

query:

http://localhost:5984/entries/_design/entries/_spatial/entriesByPeriod?bbox=0,1280998800,0,128100060

Taggings:

Changing the root password of an iPhone / ipod Touch to secure the SSH connection

 To secure your SSH connection the password for "root" has to be modified. Please, regularly change this password. Start the Terminal of your Mac or Shell of your Linux computer. For Windows an SSH application such as Putty is necessary.    

  1. Then type the following line of code, but before replace the palceholder "ip.des.iph.one" with the IP address of your iPhone to create the initial SSH connection: ssh root@(ip.des.iph.one)
  2. The standard password for all iPhones is "alpine". Type password and confirm with Enter (Please note that several Unix systems handle backspaces as new input characters).
  3. To change the root password, type "passwd" now.
  4. Then the new password is requested: Type in the new password
  5. Retype the password to confirm it
  6. Disconnect from SSH by using "Exit" (Or stay connected, if you need the SSH connection for other tasks

(Note: For iPhone without installed SSH Server this series of steps is impossible and not necessary)  There is a legal issue that hampers the overall SSH usage: Only applications from the Apple "app store" are legal to be used on an iPhone. The SSH solution is often referred to illegal "Jailbreak" solutions which cannot be recommend from legal perspective ;)However, this issue should not be ignored for all iPhones using such SSH solutions. 

Subscribe to Unix