Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I started a very resources-consuming process on a remote server via ssh. It is an optimization problem run in MATLAB. It takes full memory and CPU. In fact, I am not even able to ssh to the machine, which doesn't reply at all. How do I kill that process? I don't have root access.

share|improve this question
    
From work experience, you may have to reboot the machine. However I'm curious to know if there's a more canonical way to do it. –  rahmu Nov 29 '11 at 0:03
    
rahmu: I don't even know where the machine is located :( –  Alessandro Cosentino Nov 29 '11 at 0:05

2 Answers 2

If your user started the process, and you only have access remotely, your options are limited.

I would try remotely killing the processes, This may take some time to get queued!

ssh -l $USER $HOSTNAME 'pkill -9 MATLAB'

If this executes, but does not kill the running process. You could always kill all processes created by your user. this would be a more last resort, obviously avoid if you know the process name.

ssh -l $USER $HOSTNAME 'pkill -9 -u $USER'

If you have any KVM or IPMI access, this would be the time to bust it out.

share|improve this answer
    
the machine doesn't react to any ssh request –  Alessandro Cosentino Nov 29 '11 at 0:23
    
also, isn't the option '-p' is ssh to select the port? –  Alessandro Cosentino Nov 29 '11 at 0:30
    
Sorry, I mistakenly typed in MySQL user/pass options. How long did you wait for the machine to respond? You have eaten all resources, it could take some time. This is also why, you want to do the command in the connection. –  TechZilla Nov 29 '11 at 0:37

If the machine doesn't react to any network request, you're hosed. By a simple process of elimination, if you can't get remote access, you need console access.

Be patient. If the machine is swapping heavily, it may take several minutes to respond.

For the future, keep an ssh session open, and have the process ID of the potentially troublesome process ready. All mainstream shells have the kill command built-in, so that you can kill a process even if the machine is heavily under load or your user has reached its process limit.

Also for the future, you can limit the resources that the Matlab process can allocate by running the ulimit command in the shell where you start it. In particular, ulimit -Sv 42 will limit the total amount of virtual memory that any one process can allocate to 42kB (the limit applies to each process subsequently started by that shell).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.