Since the iPhone has no working cron deamon since 3.0 you can achieve it with the launchd deamon.
Launchd on Apple manpages
You have to have a running script, I suggest you to test it on iphone shell before going forward.
For example the script to launch could be this:
/var/root/scripts/hello
You have to create a .plist file in /System/Library/LaunchDaemons/ , I called it org.me.hello.plist
The hello.plist should be like this:
<?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.me.hello</string>
<key>ProgramArguments</key>
<array>
<string>/var/root/scripts/hello</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StartInterval</key>
<integer>300</integer>
</dict>
</plist>
After that, you have to tell the system to load this new service hello.plist
iPhone4:~ root# launchctl load /System/Library/LaunchDaemons/org.me.hello.plist
Now your script should be launched automatically every 300 seconds (5 minutes) by the iPhone.
That's all.
Nessun commento:
Posta un commento