Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import subprocess
- import signal
- import os
- #Get all proceses owned by group "download"
- proc = subprocess.Popen(["ps","-G","download"], bufsize=-1, stdout=subprocess.PIPE)
- for line in proc.stdout: #Do this for each printed line of the above command
- try:
- fields = line.split() #Split the line according to spaces
- pid = fields[0] #The first field is the PID of the process (field 4 is the name of it)
- if int(pid) > 0: #If its a positive number
- os.kill(int(pid), signal.SIGSTOP) #Send SIGSTOP to PID
- except:
- continue #If any problem, continue with the next line
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement