What you need on your phone:
It has to be Jailbroken
Prowl
any BASH shell script that you want to run
curl on the phone: optional - only needed if you want output from the script sent through Prowl.
You're not going to be editing any system files or doing anything dangerous.
First you have to take your script and make a fake app out of it so it can be ran from SpringBoard. If you don't want it on SpringBoard, you may be able to delete the icon.png or hide it some other way, but I assume these steps are necessary to make the iPhone see your script as an app.
Note: your script shouldn't need to run for long because it will open a full screen png "splash screen" which renders your phone blank until the script exits. You can kill the script by pushing the home button at any time.
In this example, I will name my script "Test" (not Test.sh. It runs fine without the file extension and I'm not sure it would work later on if it has an extension)
Make a folder called Test.app in /Applications. In that folder put:
Your bash shell script
An icon named icon.png
A plist file
A 320x460 background image named Default.png
A file named PkgInfo - the only contents are: APPL????
I'm not certain you need those last two but it took me forever to get this working right and those two were copied from another app and it works so I still use them when I create fake apps.
Open the Info.plist and edit the three things between the string tags under these keys:
CFBundleExecutable - Change this to the name of your script
CFBundleIdentifier - this can be anything but it must be unique for every script/app and in the "reverse dns" from of: com.myname.test or net.ThisIsA.Script
CFBundleName - Make this the name you want to appear under the icon on Springboard
Code: Select all
<?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>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>Test</string>
<key>CFBundleIdentifier</key>
<string>com.myname.Test</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Test</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
</dict>
</plist>
Now, open your script's Info.plist and right above the "dict" closing tag, add these lines:
Code: Select all
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>Test URL</string>
<key>CFBundleURLSchemes</key>
<array>
<string>rss</string>
</array>
</dict>
</array>
Code: Select all
<?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>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>Test.sh</string>
<key>CFBundleIdentifier</key>
<string>com.myname.Test</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Test</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>Test URL</string>
<key>CFBundleURLSchemes</key>
<array>
<string>rss</string>
</array>
</dict>
</array>
</dict>
</plist>
Open Prowl's Redirections.plist and find rss, or whatever app you are using, and edit the lines below Key and URL to the name of your script
Code: Select all
<key>Key</key>
<string>Test</string>
<key>URL</key>
<string>Test://</string>
Using curl on my computer
curl -k https://prowl.weks.net/publicapi/add -F apikey=XXXX -F application="shoe" -F description="click view to run the Test script"
Send that notification with curl, click "view" when it pops up and it will run your script. Of course, there is no output unless you have a method of sending output in the script. Putting this in the script would send you another Prowl notification that the script was ran: curl -k https://prowl.weks.net/publicapi/add -F apikey=XXXX -F application="Test" -F description="the Test script was ran" Or put the output of the script into a variable and use description="$variable"
So what are the uses? Heck if I know. Maybe endless, maybe useless.