Good day people.

I have tried for a good period of time now to work out the writing of a 
good rc script to peertube (the P2P video sharing system). I have been 
advised by a fellow member of this community to ask for better advice 
here.

Technically, Peertube is actually a node process launch in a particular 
way. It comes with several parameters and has to be launched in a 
specific directory. This just makes it all the more fun. Or not.

Here is the current script as I wrote it :

----------------
#!/bin/ksh
daemon_user="_peertube"

HOME_DIR="/var/www/peertube"
CONF_DIR="${HOME_DIR}/config/"

daemon="HOME=${HOME_DIR} NODE_CONFIG_DIR=${CONF_DIR} \
NODE_ENV=production USER=${daemon_user} \
 /usr/local/bin/node ${HOME_DIR}/peertube-latest/dist/server"

. /etc/rc.d/rc.subr

daemon_timeout=60
rc_reload=NO

pexp="node"

rc_cmd $1

------------------

So first, rcctl cannot find its process back (when making rcctl check 
peertube, it just times out - the same when the process is started).

But I know it launches the thing.

Here is the peertube line in the list of processes :

_peertub 71223  0.0 12.5 125632 129388 p2  S+     11:45PM   11:48.91 
node: peertube (node)

----------------

To had a layer of sophistication, it has to be launched in a 
subdirectory of its own installation.

It is installed in /var/www/peertube (which is $HOME_DIR in the script 
above), with configuration, video storage and logs around, but the 
software itself is in /var/www/peertube/versions/peertube-v-X.Y.Z and I 
create a synbolic link at each peertube upgrade to the new version. And 
so it has to be launched from that place. In order to achieve that, the 
_peertube user's home directory is set to /var/www/peertube/peertube-
latest/ (so the symbolic link target).

This is totally unorthodox I know, but I found no better way to do that.
I hope you have interesting comments.

Thanks for your attention.


Reply via email to