A while ago my teacher asked me to create a script that would kill Minecraft anytime it came up. It worked when the user themselves ran it, but it didn't if it was at root level.
Is there a command similar to lsof that found all processes, not just ones by the user that called lsof? I read the man page, but I'm not quite understanding it. Is there a lsof command that will get every single process, not just the users'?
This is the script, designed only for Macs:
#!/usr/bin/env python
import os
from time import sleep
while True:
os.system("lsof | grep minecraft | cut -c 11-16 >mine.txt")
f=open("mine.txt")
l = f.readline()
if len(l) > 0:
os.system("kill "+l)
f.close()
os.system("echo > mine.txt")
sleep(15)