Mac OSX:Plist运行程序样本

来源:互联网 发布:明实录知乎 编辑:程序博客网 时间:2024/05/23 20:26
下面是两个可运行的plist文件的样本


*****************************************
<?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>org.sohu.MyScript</string>
    <key>ProgramArguments</key>
    <array>
        <string>/sbin/MyScripts/MyScript</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>StartInterval</key>
    <integer>900</integer>
</dict>
</plist>


*****************************************
This plist file could be saved in /Library/LaunchDaemons/com.acme.disablespotlightonbackup.plist
and do: chmod 644; chown root:admin
and sudo launchctl load /Library....backup.plist.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/
PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Label</key>
        <string>com.acme.disablespotlightonbackup</string>
        <key>OnDemand</key>
        <true/>
        <key>ProgramArguments</key>
        <array>
                <string>/full/path/to/shell/script/created/above</string>
        </array>
        <key>StartCalendarInterval</key>
        <dict>
                <key>Munute</key>
                <integer>1</integer>
        </dict>
</dict>
</plist>
原创粉丝点击