Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

On a mis-configured or buggy network filer (NFS NAS) writing a large file can cause the filer to freeze.

For diagnostics I need to be able to:

  1. Suspend (or in other words temporary freeze) all processes of a particular user
  2. Resume the user

Basically, like a kill -s SIGSTOP and kill -s SIGCONT but for the entire user.

To do that, is there a way to temporary take away all CPU-time from a user in Linux?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

You can do this more reliably than SIGSTOP and SIGCONT by using the cgroup freezer.

share|improve this answer
    
I'm going to give it a try. Looks like I just have to echo pid of all running processes of the user into /tasks. It's a bit annoying that if the user tries to open another SSH connection then new processes will not be added to the cgroup. –  Aleksandr Levchuk May 6 '11 at 2:06
    
I could not try it. I have 2.6.36 openvz kernel for some reason I don't have the cgroup fs type when I try to do mount -t cgroup -ofreezer freezer /containers but I seems to work on Ubunut 11.04 (Linux 2.6.38) –  Aleksandr Levchuk May 7 '11 at 4:03

Try pkill -STOP -u <username> and resume with pkill -CONT -u <username>

share|improve this answer
    
This could cause problems depending on order in which pkill sends the signals. For example, suspending a child process before the parent will cause bash for-loops to break. Also, what if the user already had some processes suspended (e.g. Ctrl-Z)? –  Aleksandr Levchuk May 5 '11 at 23:42

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.