Tuesday, November 3, 2015

How to find and kill a stuck process

To find (and kill) a stuck process like a hung deamon in UNIX or Linux, use the following command from the command line:

ps -ef | grep processname (Where processname is the name of a process to be killed)

For an example, if you wanted to find all of the Java processes on the box, use the ps -ef | grep java
command. For all of the apache processes, use ps -ef | grep apache.

You should get back something like this:

user      3258  3238  0 04:31 ?        00:01:45 java -server -Xms512m

The "3258" number after the user running the Java process is the PID number of the running process.

Use this PID number to shut down the process that is running with the kill command. Make sure to enter the right PID number! An example is below:

kill 3258 

If that doesn't kill the process, try running kill -9 2358 (Or whatever your PID is) to forcibly shut down the process. Depending on the version of UNIX or Linux you're using, you might need to run this command as the root user using the sudo command. In that case, the command would look like this:

sudo kill -9 3258




Wednesday, July 16, 2008

Resetting a print queue on an AIX server

This is how you reset a print queue on an IBM AIX server. Before doing this, you may want to ping the printer and insure that it's running and connected to the network.

Run the lpstat -vprintername command. Look for stuck jobs.
Run the enq -D -Pprintername command to shut down the print queue OR enq -K -Pprintername if you also want to kill the current job that may be stuck.
Run the qadm -Uprintername command to restart the print queue.
Run the lpstat -vprintername command again to check and see if print jobs are running again.

That's it! Enjoy!