Not sure why launchctl doesn’t work as I haven’t played with it on an iPhone.
A native app might be nice on a jail token phone as you would just tap the icon to start it.
Its not to bad via mobile terminal, a native app would be nice to start it but still need to figure out how to kill it which would also be nice to have a app automate killing it as well. Baa is helping me get there to kill it via command line 
Maybe it will make it easier to make apps for each or upon quitting the plexconnect app it would clean up and kill all processes.
Looks like the plists are working but happen very quickly at ios boot. For now you need to get on your wifi asap for the plist to work otherwise plexconnect will miss the network to startup properly. If you don’t connect to wifi in time you will need to connect to wifi then you need to manually launch plexconnect by issuing one set of these commands listed below:
login (login is root & alpine is password if you haven’t changed it)
/Applications/PlexConnect
./PlexConnect.py
or manually do this for launchctl:
login (login is root & alpine is password if you haven’t changed it)
cd /Library/LaunchDaemons
launchctl unload com.plex.plexconnect.bash.plist
launchctl load com.plex.plexconnect.bash.plist
Remember you can easily reissue these commands by setting up gestures in mobileterminal outlined in the first post.
You can also kill plexconnect by doing the following:
login (login is root & alpine is password if you haven’t changed it)
killall -9 python
Or if using this plist:
login (login is root & alpine is password if you haven’t changed it)
cd /Library/LaunchDaemons
Launchctl unload com.plex.plexconnect.plist
Here is the plist (credits to chris hulbert https://gist.github.com/chrishulbert/5772931):
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
“http://www.apple.com…rtyList-1.0.dtd”>
Label
com.plex.plexconnect
WorkingDirectory
/Applications/PlexConnect
ProgramArguments
/Applications/PlexConnect/PlexConnect.py
RunAtLoad
KeepAlive
I imagine you can do with with the com.plex.plexconnect.bash.plist as well but I havent tested it, yet:
login (login is root & alpine is password if you haven’t changed it)
cd /Applications/PlexConnect
./PlexConnect_daemon.bash stop
Im digging into the bash not working on ios which is strange because it works on the appletv just fine. Aything in here that would be causing the PlexConnect.bash to not start on ios, when I try to launch that from the ios atv jailbreak folder directly it just locks up the command line and won’t do anything, same goes for the one in the OSX folder as well (maybe its missing a package?)
#!/bin/bash
#
OSX PlexConnect startup script
#
Package
APPNAME=“PlexConnect.py”
Determine if the network is up by looking for any non-loopback network interfaces.
Currently supports only OSX “Darwin” OS
CheckForNetwork()
{
local test
if [ -z “${NETWORKUP:=}” ]; then
test=$(ifconfig -a inet 2>/dev/null | sed -n -e ‘/127.0.0.1/d’ -e ‘/0.0.0.0/d’ -e ‘/inet/p’ | wc -l)
if [ “${test}” -gt 0 ]; then
NETWORKUP=“-YES-”
else
NETWORKUP=“-NO-”
fi
fi
}
Wait for network readiness.
This avoids the binding of PlexConnect to the loopback address which may otherwise occur
if the bash script is called from a LaunchDaemon/plist file at boot time.
CheckForNetwork
while [ “${NETWORKUP}” != “-YES-” ]
do
sleep 5
NETWORKUP=
CheckForNetwork
done
pwd
ls
Start PlexConnect
./${APPNAME}
Update it looks like PlexConnect.bash is getting stuck on the 2nd half during the do thru done loop within the script. I made a temporary PlexConnect.bash (I hope this issue is only due to the ios 5.0.1 revision) to allow for 2 minutes before plexconnect launches to allow time for logging into wifi at boot, for the time being, here it is edited with all the network stripped out since it locks up the bash on ios 5.0.1:
#!/bin/bash
#
OSX PlexConnect startup script
#
Package
APPNAME=“PlexConnect.py”
sleep 120
pwd
ls
Change Directory & Start PlexConnect
cd /Applications/PlexConnect
./${APPNAME}
So far the easiest way so far is to sftp this temporary PlexConnect.bash in /support/osx, enable airplane mode, connect to desired remote wifi, install sbsettings (free cydia tweak from BigBoss repo) swipe left at top right of screen using the power option then select reboot, within two minutes unlock the ios device then plug it into power to use plexconnect on a jailbroken ios device. I then don’t need to mess with terminal anymore upon reboot and thats good enough for me ![]()
Thats sure was fun. Here is a bash script that works perfectly with launchctl on ios, enjoy ![]()
#!/bin/bash
#
OSX PlexConnect startup script
#
Run in a loop until successfully connected to the internet
until wget -q -O - http://www.google.com | grep Lucky > /dev/null; do
sleep 10
done
exec $1&
Change directory & launch plexconnect
cd /Applications/PlexConnect
./PlexConnect.py
nice solution wahlman.j
The original network detection code will keep the script running indefinitely until CheckForNetwork sets NETWORKUP to “-YES-,” so if there’s a networking problem your code may never execute.
which is what you were facing. :)
out of curiosity, could you manually run the following command in a terminal window, and post the response? i'm wondering if the command is valid on ios.
ifconfig -a inet
this should dump something like:
lo0: flags=8049 mtu 16384 options=3 inet 127.0.0.1 netmask 0xff000000 gif0: flags=8010 mtu 1280 stf0: flags=0<> mtu 1280 en0: flags=8863 mtu 1500 options=27 en1: flags=8863 mtu 1500 inet 10.0.0.7 netmask 0xffffff00 broadcast 10.0.0.255 p2p0: flags=8843 mtu 2304
I belive I had to install ifconfig by running the command:
apt-get install ifconfig
But I ran a lot trying to get the original code running, here it is reguardless if I need to install it or not:
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
inet 127.0.0.1 netmask 0xff000000
pdp_ip0: flags=8011<UP,POINTOPOINT,MULTICAST> mtu 1024
ifconfig: pdp_ip0 has no inet interface address!
pdp_ip1: flags=8011<UP,POINTOPOINT,MULTICAST> mtu 1024
ifconfig: pdp_ip1 has no inet interface address!
pdp_ip2: flags=8011<UP,POINTOPOINT,MULTICAST> mtu 1024
ifconfig: pdp_ip2 has no inet interface address!
pdp_ip3: flags=8011<UP,POINTOPOINT,MULTICAST> mtu 1024
ifconfig: pdp_ip3 has no inet interface address!
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
inet 192.168.2.45 netmask 0xffffff80 broadcast 192.168.2.127
ap0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
ifconfig: ap0 has no inet interface address!
en1: flags=8822<BROADCAST,SMART,SIMPLEX,MULTICAST> mtu 1500
ifconfig: en1 has no inet interface address!
The thing is the bash works perfect on the atv2, I watch it and it executes it perfectly but when I try it on my iphone it stops at done after it has attempted the script if my internet is working or not. But using the changed code it works fine.
Here is what it looks like when it is not working with the wifi connected or not. If I do the same on the atv it completes the code perfectly.
ok, so the ifconig command exists and seems to be working, can we expand out now and run the whole command line?
ifconfig -a inet 2>/dev/null | sed -n -e '/127.0.0.1/d' -e '/0.0.0.0/d' -e '/inet/p' | wc -l
you should get a response like:
1
could you also expand on your comment:
but when I try it on my iphone it stops at done after it has attempted the script
is it stopping by freezing (going into an endless loop) or returning to the command prompt without running PlexConnect?
I am not using this one (Cause i am on 7 too :) ) but if anyone knows how to write an application that'll install with it all other apps needed to run PlexConnect so there will be an app from cydia called PlexConnect and when you open it you have a pause and start button .. That can be nice
The top half of the PlexConnect.bash script works fine its the lower do done loop function that seems its stopping it from completing the code. Hopefully its only due to it being phone 4 ios 5.0.1 specific and not ios device wide besides the atv of course. If more people would test and post results we would know the answer to that.
the lower do done loop will not stop until the value for NETWORKUP is not equal to -YES-. and NETWORKUP will only equal -YES- if there is a non-zero response to the ifconfig command.
a complication which may exists for the iphone is that there may be a non-zero response due to the mobile data network connection being up, rather than the wifi connection. which is why i'm keen to see if you get a 1 or a 2 above.
nb: running the seconfd half of the script on the command line won't give you a good feel for what is happening as it calls upon a function "CheckForNetwork" which hasn't been defined.
I also have airplane mode turned on to keep the wifi running which in turn keeps plexconnect running and no sim card installed.
I have also created a rc.common file in /etc with this code:
http://www.opensource.apple.com/source/launchd/launchd-442.26.2/rc/rc.common
Also I included this in the bash to fix the (CheckForNetwork command not found) issue which still produced the same results with the loop issue not completing reguardless if this is included in PlexConnect.bash or not:
. /etc/rc.common
I am not using this one (Cause i am on 7 too :) ) but if anyone knows how to write an application that'll install with it all other apps needed to run PlexConnect so there will be an app from cydia called PlexConnect and when you open it you have a pause and start button .. That can be nice
Oh you're interested now.
Sent from my iPhone using Tapatalk
Strange that this doesn’t work on all iPads. I think I know why. I’ll let u know later.
Sent from my iPhone using Tapatalk
I also have airplane mode turned on to keep the wifi running which in turn keeps plexconnect running and no sim card installed.
Umm airplane mode disables the wifi and cellular radios.
It does keep the wifi radio off until you flip it back on, thats what im using to keep plexconnect running so my wifi stays on like the insomnia app would. You can test by turning on airplane mode, turning your wifi back on and connecting to your desired wifi, restarting your ios device then ulocking it. When you unlock the device even though airplane mode was selected before reboot it will connect to the wifi on its own and keep the wifi alive which in turn keeps plexconnect alive indefinately wherever you decide to host plexconnect. I have tried the daemon with and without airplane mode both produce a endless loop failure unless I use the changed code from post #24 in place of the default PlexConnect.bash on my iphone 4 ios 5.0.1.
That makes more sense if you are turning the wifi back on after having been in aeroplane mode.
A downloadable zip and instructions are here if anyone wants to use or test it. I have automated a lot of the installation for ios devices just follow the readme.txt in /support/IOS_jailbreak. This is just a start and can be expanded on in the future.
https://github.com/wahlmanj/PlexConnect
Im looking into making a automated script for installing python and getting the updates/upgrades as well.
IOS 7 jailbreak released! NOT for ATV but we can now use this guide to run PlexConnect from any iPhone, iPod touch or iPad!!