PlexRequests as a service

Status
Not open for further replies.

tonyp1983

Dabbler
Joined
Feb 17, 2015
Messages
31
Hi, I've just stumbled upon PlexRequests (https://github.com/lokenx/plexrequests-meteor) a pretty awesome looking web app to allow my Plex shared users to make requests, rather than just messaging me day and night, with automation for my CouchPotato and Sickrage setup.

It is dependent on meteor which I've managed to install, along with it's dependencies using this version of meteor from github https://github.com/4commerce-technologies-AG/meteor

All up and running but only when manually initiated from a shell by navigating to the PlexRequests folder (/usr/local/share/plexrequests), typing meteor and hitting enter.

I've never had any success trying to create my own rc.d scripts. Is anyone able to help? It would be much appreciated. :)
 

tonyp1983

Dabbler
Joined
Feb 17, 2015
Messages
31
Okay, so I've done some more searching and reading up and I've got somewhere in terms of getting things running as a service. I've built a rc.d script that calls another script and daemonises it. It's a bit clunky, and I can't figure out how to get the pid to write back to the pid file created so that the stop command can be used but it's a start.

For those who maybe interested, the script that starts up PlexRequests is (change file paths depending on where you git clone PlexRequests to):
Code:
#!/bin/sh


cd /usr/local/share/plexrequests ; meteor -p 3000 --production


And the rc.d script is (with the command line pointing to the file where you put the first script):
Code:
#!/bin/sh
# REQUIRE: LOGIN
. /etc/rc.subr

name=plexrequests
rcvar=plexrequests_enable
command="/usr/local/share/plexrequests/daemon.sh"
start_cmd="${name}_start"
plexrequests_user=root
pidfile="/var/run/${name}.pid"

load_rc_config $name
: ${plexrequests_enable:=no}
: ${plexrequests_msg="${name} starting."}

plexrequests_start()
{
        /usr/sbin/daemon -u $plexrequests_user $command

        echo "$plexrequests_msg"
}

run_rc_command "$1"


You'll also need to add the following line to your rc.conf:
Code:
plexrequests_enable="YES"


If anyone can help me expand on this to make it more functional, I'd appreciate it.
 
Status
Not open for further replies.
Top