Sections

Main/Advocacy




Main
Recent Changes Printable View Page History RSS Feed Edit Page
Copy this text to a file called "kn" in /usr/local/bin and then use the command "chmod +x /usr/local/bin/kn" to make it executable.

#!/usr/bin/perl $netscapeName = "nets";

#####################

# kn - kill Netscape

#####################

# Author: Andy Deck

# http://artcontext.com

# Developing Java under Red Hat 6, Netscape 4.61

# often freezes up, so I'm often killing

# zombie Netscape processes. If you are

# having the same problem, kn is easy

# to type.

# Possible improvement: -n flag option to

# start a new Netscape process.

# A few lines of perl...

open(PS, "ps -ax | grep $netscapeName | grep -v grep |"); while($line=<PS>){
  ($slot1,$slot2,$fluf) = split(/\ +/,$line);
  # this ps split is unpredictable
  # so we check for a number
  if($slot1 =~ /[0-9]/){
        `kill -9 $slot1`;
        print("Killing $slot1\n");
  }
  else{
     print("Killing $slot2\n");
     `kill -9 $slot2`;
  }
}

Page last modified on June 01, 2004, at 06:51 PM