自动备份JailBreak iPhone DCIM照片目录

时间:2011-06-08 19:02:40

标签: iphone ios launchd

您好我听说您可以将cron作业写入plist并以plist格式将其放入JB iPhone / Library / LaunchDaemons文件夹

我想每隔300秒备份一次照片文件夹,所以我把这样的com.backup.plist放到/ Library / LaunchDaemons文件夹中

<?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>KeepAlive</key>
    <true/>

    <key>Label</key>
    <string>com.backup</string>

    <key>Program</key>
    <string>/bin/cp</string>

    <key>ProgramArguments</key>
    <array>
        <string>-u</string>
        <string>/private/var/mobile/Media/DCIM/100APPLE/*.*</string>
        <string>/private/var/backup</string>
    </array>

    <key>StartInterval</key>
    <integer>300</integer>

</dict>
</plist>

我创建了一个/ private / var / backup文件夹,访问权限为777 mobile:mobile

我重新启动了iPhone,然而,该脚本无效

失败是指“cp”命令访问权限吗? 或者我应该将/ private / var / backup文件夹访问权限更改为其他内容吗?

btw我正在运行iOS 4.3.3 Jailbreak iPhone 4

非常感谢您的阅读

1 个答案:

答案 0 :(得分:0)

我没有在iPhone上使用launchd,但在Mac OS X上,ProgramArguments的第一个字符串需要是程序名称本身。尝试从以下位置更改该部分:

<key>ProgramArguments</key>
<array>
    <string>-u</string>
    <string>/private/var/mobile/Media/DCIM/100APPLE/*.*</string>
    <string>/private/var/backup</string>
</array>

要:

<key>ProgramArguments</key>
<array>
    <string>cp</string>
    <string>-u</string>
    <string>/private/var/mobile/Media/DCIM/100APPLE/*.*</string>
    <string>/private/var/backup</string>
</array>