Hi I heard that you can write cron job into plist and put it to JB iPhone /Library/LaunchDaemons folder in plist format

I would like to backup the photo folder every 300 seconds, so I put a com.backup.plist like this into /Library/LaunchDaemons folder

<?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">






I have created a folder of /private/var/backup with access right of 777 mobile:mobile

I rebooted the iPhone, however, the script just doesn't work

Does the failure refer to the "cp" command access right? or should I change the /private/var/backup folder access right to something else?

btw I'm running iOS 4.3.3 Jailbreak iPhone 4

Many thanks for reading

  • 1
    Do you get any error messages in the log files? – Kerri Shotts Jun 14 '11 at 3:35
  • where will the log file of launchdaemons be located? – Unreality Jun 16 '11 at 6:26

From the man lanuchctl

Note that per-user configuration files (LaunchAgents) must be owned by the user loading them. All system-wide daemons (LaunchDaemons) must be owned by root. Configuration files must not be group- or world-writable. These restrictions are in place for security reasons, as allowing writability to a launchd configuration file allows one to specify which executable will be launched.


chown root  /Library/LaunchDaemons/your.plist 
chgrp wheel /Library/LaunchDaemons/your.plist 
chmod 644   /Library/LaunchDaemons/your.plist

and after these:

launchctl load /Library/LaunchDaemons/your.plist

According to Wikipedia's article on cp:

To copy a directory to a directory (-r or -R must be used)

So try adding <string>-r</string> to the list of arguments. Reboot your device and after 5 minutes (300 seconds) check if it worked.


  • since running code cp -u /private/var/mobile/Media/DCIM/100APPLE/*.* /private/var/backup code directly in shell has no problem copying the files, so I believe the problem isn't about the argument of cp – Unreality Jun 20 '11 at 8:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .