Install PlexConnect using pkgng

So freeNAS updated their software to 9.2.1.2 which now used pkgng commands instead of pkg_add. Spent quite a few fustrating hours getting PlexConnect working but finally achieved it. Have listed instructions below to hopefully be of use to others.

 

Hi everyone

Have been using PlexConnect on a freeNAS box previously however with the new updates in their system it broke the old commands i used to install and run PlexConnect.

 So to install git, python, nano and bash i used the following:

pkg install git
pkg install python27
pkg install nano
pkg install bash

All installed fine. Next i cloned PlexConnect using the following:

git clone https://github.com/iBaa/PlexConnect.git

All good so far.

I next cd’ed into the PlexConnect folder and then tryed to run PlexConnect.py. This is the error that i got.

root@PlexConnect:/PlexConnect # ./PlexConnect.py
env: python: No such file or directory
root@PlexConnect:/PlexConnect # 

I though ok i will just copy my old ‘Settings.cfg’ and cert into the correct folders and then just start the service using

bash /PlexConnect/PlexConnect_daemon.bash start

I then got this error:

root@PlexConnect:/PlexConnect # bash /PlexConnect/PlexConnect_daemon.bash start
Starting PlexConnect...
/PlexConnect/PlexConnect_daemon.bash: line 29: python: command not found
root@PlexConnect:/PlexConnect # 

To fix this error you need to edit the following file.

nano /PlexConnect/PlexConnect_daemon.bash

You should the the following:

#!/bin/bash

#
# Linux PlexConnect start stop script
#

# Package
DNAME="PlexConnect"
PNAME="PlexConnect_daemon"

# Others
# current path resolver from http://stackoverflow.com/a/246128
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do
  DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
  SOURCE="$(readlink "$SOURCE")"
  [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
done
INSTALL_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

PYTHON="python" 
PROGRAM="${INSTALL_DIR}/${PNAME}.py"
PID_FILE="/var/${PNAME}.pid"

Edit the PYTHON line as follows (so that it references the python instance explicitly):

PYTHON="/usr/local/bin/python2.7"

Save the file. 

Now you should be able to use the following command to start PlexConnect

bash /PlexConnect/PlexConnect_daemon.bash start

 

 

3 comments

  1. You don’t need to install nano. The editor in Freenas ee is as good as nano.
    Also python2.7 is already installed on Freenas so the pkg command will fail. In the jail you have to tell where python2.7 can be found. So either use /usr/local/bin/python2.7 as command or add the path /usr/local/bin to the PATH in the jail.
    So for example you may start PlexConnect in the root of the jail as follows:
    /usr/local/bin/pyrhon2.7 PlexConnect/Plexconnect.py and stop it with ctrl+C

Leave a comment