Will this method run on a ClearOS server? It uses dnsmasq for DHCP and DNS. I'm not sure yet to run Plexconnect on my Synology or ClearOS server. Maybe i'm going to sell the Synolgy unit and it would be nice if i can make this running on my ClearOS server.
I have installed PMS onto my Ubuntu Server 12.04 with no issues
I have installed and run PlexConnect OK and my Apple TV trailers work fine. However as the SSH pipe drops from my iMac to the Server I loose the PlexConnect hack.
I worked thru this to try and get PlexConnect to start at boot on the server. All of step 4 seemed to go fine, however when I do: sudo update-rc.d plexconnect defaults
I get the following error:
update-rc.d: warning: plexconnect start runlevel arguments (2 3 4 5) do not match LSB Default-Start values (3 4 5)
System start/stop links for /etc/init.d/plexconnect already exist.
As a complete Newbie to Ubuntu, I have no idea what this means or how to fix...... any help would be appreciated. I dont want to dump my ATV3 and buy a Roku, just to fix this!
These instructions will cause update-rc.d to read the comments at the top of the script (shown below) and setup the daemon appropriately. Do you also have a daemon called plexmediaserver on the server that you are installing plexconnect on? If not remove plexmediaserver from the Required-Start and Required-Stop entries or else the daemon won't start since there is not a running plexmediaserver.
Of course I didi all the steps… The error is the one mentionend above.
I do have a running plexmediaserver-deamon on the Ubuntusystem, so it should work, so far I understand it, anyway…
Strange though, after the last update, the deamon doesn't get startet via 'sudo service plexconnect start'.
I just get:
*Plexconnect process is not running
*Starting the process PlexCOnnect
But when I type 'sudo service plexconnect status'
I get the status
*PlexConnect process is not running
Strange… I absolutely don't know what to do to get kit working…
I have done some modifications from the ubuntu initscript to make it compatible with Debian and PMS for Debian (see Debian release thread becuase one thing is needed to be changed in PMS initscript as well)
#!/bin/bash
### BEGIN INIT INFO
# Provides: plexconnect
# Required-Start: plexmediaserver
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: This is the Plex Connect daemon
# Description: This script starts the Plex Connect
# Python scripts in a detached screen.
### END INIT INFO
# Using the lsb functions to perform the operations.
. /lib/lsb/init-functions
# Process name ( For display )
NAME=PlexConnect
# Daemon name, where is the actual executable
DAEMON="/usr/bin/screen"
DAEMON_OPTS="-S PlexConnect -d -m /locationtoplexconnect/PlexConnect/PlexConnect.py"
DAEMON_USER="root"
# pid file for the daemon
PIDFILE=/var/run/PlexConnect.pid
# If the daemon is not there, then exit.
test -x "$DAEMON" || exit 5
case $1 in
start)
# Checked the PID file exists and check the actual status of process
if [ -e $PIDFILE ]; then
status_of_proc -p $PIDFILE "$DAEMON $DAEMON_OPTS" "$NAME process" && status="0" || status="$?"
# If the status is SUCCESS then don't need to start again.
if [ $? = "0" ]; then
log_success_msg "Starting the process $NAME"
exit # Exit
fi
fi
# Start the daemon.
# Start the daemon with the help of start-stop-daemon
# Log the message appropriately
if start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --startas $DAEMON -p $PIDFILE -- ${DAEMON_OPTS}; then
while read line ; do [[ $line =~ ([0-9]*).PlexConnect ]] && echo ${BASH_REMATCH[1]} ; done < <(screen -ls) > $PIDFILE
log_success_msg "Starting the process $NAME"
else
log_failure_msg "Starting the process $NAME"
fi
;;
stop)
# Stop the daemon.
if [ -e $PIDFILE ]; then
status_of_proc -p $PIDFILE "$DAEMON DAEMON_OPTS" "Stoppping the $NAME process" && status="0" || status="$?"
if [ "$?" = 0 ]; then
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
/bin/rm -rf $PIDFILE
log_success_msg ""Stopping the $NAME process""
fi
else
log_failure_msg "$NAME process is not running"
fi
;;
restart)
# Restart the daemon.
$0 stop && sleep 2 && $0 start
;;
status)
# Check the status of the process.
if [ -e $PIDFILE ]; then
status_of_proc -p $PIDFILE "$DAEMON $DAEMON_OPTS" "$NAME process" && exit 0 || exit $?
log_success_msg "$NAME process is running"
else
log_failure_msg "$NAME process is not running"
fi
;;
reload)
$0 restart
;;
*)
# For invalid arguments, print the usage message.
echo "Usage: $0 {start|stop|restart|reload|status}"
exit 2
;;
esac
After changing out to your new startup script, does it have to be re-registered? Could you tell us the steps needed to change-out the script for Ubuntu 12.04?
In my case it's exactly like that… The error/warning is like Hollymoons.
Of course I didi all the steps… The error is the one mentionend above.
I do have a running plexmediaserver-deamon on the Ubuntusystem, so it should work, so far I understand it, anyway…
Strange though, after the last update, the deamon doesn't get startet via 'sudo service plexconnect start'.
I just get:
*Plexconnect process is not running
*Starting the process PlexCOnnect
But when I type 'sudo service plexconnect status'
I get the status
*PlexConnect process is not running
Strange… I absolutely don't know what to do to get kit working…
deLoco,
I had the problem that as I was doing trial and error to get this startup script configured properly, somewhere along the way the /var/run/PlexConnect.PID file got created by the script, but didn't get properly deleted when the PlexConnect was no longer running. Apparently, the script creates that file, to exist only while the PlexConnect process is running. Not sure exactly where in the shutdown it should be deleted, but in my case somehow the file didn't get deleted properly at some point. Thus, in my case, the PlexConnect startup script would never startup the PlexConnect again, until I deleted that file by following step to remove that file (don't worry the script will create the file again the next time a startup is attempted).
$ sudo rm /var/run/PlexConnect.PID
Hope maybe that helps you, and any others that struggle to make this work.
Additional Tips for running the plexconnect startup script on Ubuntu 12.04. I finally have the startup working on my Ubuntu 12.04 in a VMware VM. This works very well now. The most crucial tidbit is that a delay was needed to be injected into the start portion of the script (which is what got my setup working after hours of trial an error and looking at logs). Specifically I added a 15 second delay to the following section of code.
# Start the daemon.
# Start the daemon with the help of start-stop-daemon
# Log the message appropriately
sleep 15 # <========== This is the best place (I could find to add) the 15 second sleep, and Ubuntu 12.04 now works
if start_daemon -u $DAEMON_USER -p $PIDFILE $DAEMON $DAEMON_OPTS; then
while read line ; do [[ $line =~ ([0-9]*).PlexConnect ]] && echo ${BASH_REMATCH[1]} ; done < <(screen -ls) > $PIDFILE
Additionally, (on Ubuntu 12.04 x86_64 Desktop), I registered the script into the LSB init.d system with following command:
$ sudo update-rc.d plexconnect defaults 95 05
I'd really like to say huge thanks to f00b4r for the development of PlexConnect, and a little smaller thanks to wilsoncd2 for his help via his shared experience by the postings I've found on this forum. (the startup script he provided allowed packaging the PlexConnect service up in a VM as an appliance I can be easily started-n-stopped at will, contained in it's own sandbox).
BTW, you might think the overhead of a VM might slow things, but a couple hours testing reveals no hickups, it runs just as well as it did against bare-metal (the VMware server is also pretty beefy...6 cores @ 3.6 GHz....but my guess is you don't "need" nearly that much power for PlexConnect).
To be honest, I dont have any problems running plexconnect without any kind of delay on ubuntu (server) 12.04, but server and desktop shouldnt make any difference here
Baa and Roidy deserve most of the credit for the code (along with a few nice contributions by others).
PlexConnect shouldn't need any real power, you can run it on a jailbroken ATV or on a Tomato router, the power is needed at the PMS end if you media requires transcoding. ;)
echo "Usage: 0 {start|stop|restart|reload|status}"<br>
exit 2<br>
;;<br>
esac<br><br>
as an edit if I run Plexconnect via ssh my settings are:<br><br>
~/PlexConnect sudo ./PlexConnect.py
I'm running this on CentOS 6.4 and it's running great as a daemon with your instructions. Thanks a ton for writing them.
I have installed Python 2.7 as a separate install so that any 2.6 dependencies weren't broken. What do I have to change in the PlexConnect and/or Screen daemon setup so that it's launched using Python 2.7 and not the default Python 2.6? No idea what I have to change and I don't want to break anything since I finally have everything running perfectly.
With help of this thread (and some other resources) I have posted an how-to for PlexConnect in combination with a Linux Debian Server and a non-default listen-port on my blog on http://eye-vision.homeip.net/1408/plexconnect-en-appletv-met-debian/. It is in Dutch, but I guess with Google Translate you can figure out what I did ;-).
I'm running this on CentOS 6.4 and it's running great as a daemon with your instructions. Thanks a ton for writing them.
I have installed Python 2.7 as a separate install so that any 2.6 dependencies weren't broken. What do I have to change in the PlexConnect and/or Screen daemon setup so that it's launched using Python 2.7 and not the default Python 2.6? No idea what I have to change and I don't want to break anything since I finally have everything running perfectly.
Anyone that is running a apache vhost configuration will need 2 entries.
Both are identical except for the ServerName property.
One will need to be: ServerName atv.plexconnect
and the other will need to be ServerName trailers.apple.com
Was stuck with the "Trailers not available at this time" error but everything else looked normal. I had to really pay attention to the PlexConnect.log for intercept tid-bits to catch this.
Had everything running before the update Apple pushed down the other day. For whatever reason, I wanted to start fresh. Created a clean Ubuntu Server 12.04 VM in Parallels for the job. Only SSH server added. No Apache or DNS services.
If I launch PlexConnect manually everything works. When I use the script, PlexConnect loads, but the AppleTV gives me an error and doesn't connect.
Prior to Apple's updates I had this all working wonderfully. Yesterday I took the effort to fix correct PlexConnect to get it all running again on it's own and it will work now when I have Apache SSL disabled. Right now I have the following added to my Settings.cfg file:
And an apache virtual host in /etc/apache2/conf.d/appletrailers.conf
ServerName trailers.apple.com
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://localhost:8089/
ProxyPassReverse / http://localhost:8089/
<Location />
Order allow,deny
Allow from all
</Location>
This works great, but I'd love to get SSL also redirected if at all possible... Tried setting port_ssl to 8090 with this appended to appletrailers.conf, but it didn't work for me. Any suggestions for how to do it right? NB: Listen 443 and mod_ssl are present/enabled.
ServerName trailers.apple.com
SSLEngine on
SSLCertificateFile /etc/plexconnect/trailers.cer
SSLCertificateKeyFile /etc/plexconnect/trailers.key
#SSLCertificateChainFile /etc/plexconnect/trailers.cer
ProxyRequests Off
ProxyPreserveHost On
Order deny,allow
Allow from all
ProxyPass / https://localhost:8090/
ProxyPassReverse / https://localhost:8090/
Order allow,deny
Allow from all