如何防止进程自动重启?(特别是sophos antivirus)


13

VPN软件要求我安装并运行Sophos防病毒软件。但是,当我不在VPN上时,我根本不希望它运行-我希望它消失。

但是,杀死任务是无效的:

ps -ax | grep -i soph
40972 ??         0:07.34 /Library/Sophos Anti-Virus/SophosAutoUpdate.app/Contents/MacOS/SophosAutoUpdate -d
41069 ??        28:08.48 /Library/Sophos Anti-Virus/InterCheck.app/Contents/MacOS/InterCheck -d
41078 ??         0:02.42 /Library/Sophos Anti-Virus/SophosAntiVirus.app/Contents/MacOS/SophosAntiVirus -d
$ sudo kill 40972 41069 41078 41084
$ ps -ax | grep -i soph
44344 ??         0:00.03 /Library/Sophos Anti-Virus/SophosAutoUpdate.app/Contents/MacOS/SophosAutoUpdate -d
44345 ??         0:00.02 /Library/Sophos Anti-Virus/SophosAntiVirus.app/Contents/MacOS/SophosAntiVirus -d
44347 ??         0:03.03 /Library/Sophos Anti-Virus/InterCheck.app/Contents/MacOS/InterCheck -d

它只是自动重启。我需要怎么做才能防止这种情况?


Sophos软件中是否有偏好将其关闭?
daviesgeek 2011年

据我所知,如果在那儿,那是隐藏的。
keflavich 2011年

Answers:


17

这意味着存在另一个重新启动它的监视进程。

您可以检查出谁是父流程:在活动监视器中选择该流程并使用“信息”按钮,或者通过终端,ps -ax -O ppid如果我没有记错的话。

  • 这可能是Sophos的另一个过程,但是带有一个隐身名称,甚至可能是您的VPN软件。在这种情况下,您可以kill全部解决。

  • 另一种可能性是启动守护进程使该进程保持活动状态launchd。在这种情况下,你会发现在你的杀毒软件的条目(的plist XML文件)或者~/Library/LaunchAgents/Library/LaunchAgents(可能)或/System/Library/LaunchAgents(我真希望不是)。

如果是第二种情况,则可以:

  • 编辑文件,然后更改KeepAlive参数(删除或更改)(您可以做一些漂亮的事情,有关更多信息,请参阅文档)。

  • 只是问启动为您做停止。不幸的是,您不能直接告诉,launchtl stop因为该过程会重新生成。您必须使用
    sudo launchctl unload /path/to/the/plist file


感谢Agos,这正是我一直在寻找的建议。但是,我找不到该死的东西!没有可与Sophos Anti-Virus关联的编号接近(原始的,已被预先杀死的)Sophos Anti-PID。LaunchAgents目录中没有任何内容(尽管我所做的只是在/ System /中进行了一个简单的正则表达式检查)。是否有在其中启动的日志文件会记录重启过程?我检查过system.log和其他没有运气的人
keflavich 2011年

给我的文件在这里/Library/LaunchDaemons/com.sophos.common.servicemanager.plist-您可以通过找到mdfind -name Sophos。删除“保持活动”参数即可。
Dhruv Ghulati '16

对于/ System / Library / LaunchDaemons中的进程不起作用-OSX给您一个错误“找不到指定的服务”
亚当

7

我会对Agos的帖子发表评论,但是我太新了,不能这样做。所以:

据我所记得,他们应该在/Library/LaunchAgents。我只是要求你做一个ls /Library/LaunchAgentsls /Library/LaunchDaemonsls /System/Library/LaunchDaemons会有东西出现。

您也可以打开/Applications并检查卸载Sophos.app,Show Package Contents然后签出卸载脚本。


1
谢谢鬼 Agos遗漏的目录是/ Library / LaunchDaemons,其中包含plist文件。我给了您+1,但Agos给出了答案,因为他得到了大部分。我非常感谢您的协助!
keflavich 2011年

确保在“卸载” mdfind -name Sophos
chiggsy 11/9/18

@chiggsy为什么他要这么做?他不想卸载该应用程序,但阻止其在每次杀死它时重新启动。
GhostLyrics 2011年

而已?这就是他想要的吗?
chiggsy 2011年

4
man launchctl


launchctl list |grep -i 'sophos'

永久卸载守护程序,但不卸载它

launchctl unload -w /full/path/to/file.plist

1
这是“更好”的答案,因为它还会阻止它永远加载(-w)
Dustin

sophos的皮革。这不适用于sophos。

1

找出哪个launchd工作正在产生东西,tail -f /var/log/system.log以及sudo kill -9 <pid>您感兴趣的过程。

突然,launchd会告诉您确切的工作:

com.apple.launchd[1] (com.sophos.managementagent[83911]): Exited: Killed: 9

您还可以尝试提高日志级别以准确确定正在发生的情况: launchctl log level debug

请记住,某些作业将以方式运行root,因此sudo launchctl list可能会向您显示一些在计算机上运行的额外作业。


0

您还可以使用有用的应用程序Lingon(可通过Mac App Store和在线获得)来控制运行哪些Launch Agent和Daemon以及何时运行。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.