【问题标题】:Mac launch daemon keeps loading the firewall shell scriptMac 启动守护进程不断加载防火墙 shell 脚本
【发布时间】:2013-08-26 07:45:00
【问题描述】:

启动守护进程正常工作,但现在的问题是它不断加载相同的 shell 脚本,我可以看到同一规则的多个条目。 sudo ipfw list。如何预防?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.apple.ipfw</string>
    <key>OnDemand</key>
    <false/>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/ipfw.apple.startup.sh</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>ServiceDescription</key>
    <string>Apple IPFW Filter Rules</string>
    <key>StandardErrorPath</key>
    <string>/var/log/ipfw.apple.stderr</string>
    <key>StandardOutPath</key>
    <string>/var/log/ipfw.apple.stdout</string>
    <key>UserName</key>
    <string>root</string>
</dict>

【问题讨论】:

    标签: macos shell launchd


    【解决方案1】:

    在 plist 文件中使用 LaunchOnlyOnce 键。

    LaunchOnlyOnce : 此可选键指定作业是否只能运行一次且只能运行一次。换句话说,如果 如果没有完整的机器重新启动,作业无法安全地重新生成,然后将此键设置为 true。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-08-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-28
      • 1970-01-01
      • 1970-01-01
      • 2011-08-28
      相关资源
      最近更新 更多