SOLVED etherpad in a jail | rc.d script

Joined
Jan 27, 2020
Messages
577
Making Etherpad run a jail locally is straight forward.
install git npm and node, clone the git, run.sh and you're good.

Now I'm struggling to have it start and run as a service. So far I've put together this rc.d script which is not working:

Code:
#!/bin/sh
#

# PROVIDE: etherpad
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf to enable etherpad:
#
# etherpad_enable="YES"
#

. /etc/rc.subr

name="etherpad"
rcvar=${name}_enable


start_cmd="${name}_start"
#stop_cmd="${name}_stop"

load_rc_config $name

etherpad_user="etherpad"
procname="java"


pidfile=/var/run/etherpad/etherpad.pid
daemon_args=" -c -f /usr/local/www/etherpad-lite/src/bin/run.sh"
etherpad_start()
{
    su -l ${etherpad_user} -c "/usr/sbin/daemon ${daemon_args}"
}

run_rc_command "$1"


I'd appreciate some ideas?
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
I'd appreciate some ideas?
Since you're starting a shell file, I'm not sure if you aren't going to need to pass it via the shell interpreter... like /bin/sh ...
 
Joined
Jan 27, 2020
Messages
577
Since you're starting a shell file, I'm not sure if you aren't going to need to pass it via the shell interpreter... like /bin/sh ...
it's a pitty, would have been an easy fix, but it is not working.

There is a whole bunch of script examples on the github, unfortunately missing FreeBSD.

I had hoped to patch something together from there, but noticed I lack the knowledge...
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
I see a reference in there to safeRun.sh... maybe try that one instead?

Also would be worth a look at what that scrips is actually running... maybe it can be run directly instead.

I had a look at the rc.d from nodered thinking it would be similar to what's needed since it also runs on node.js, but unfortunately it starts with an executable, not a script.

Maybe we can look around for another working plugin that uses node.js (I think homebridge or a few others might be candidates)
 
Last edited:
Joined
Jan 27, 2020
Messages
577
Maybe we can look around for another working plugin that uses node.js (I think homebridge or a few others might be candidates)
brilliant idea. This has brought me to pm2, the nodejs package manager that can start / stop any node app

Code:
npm install -g pm2
pm2 startup rcd
sysrc pm2_enable="YES"

pm2 start homebridge -- -D
pm2 save



Will try that when I'm home.
 
Joined
Jan 27, 2020
Messages
577
Yep, that was the right pointer. Works phenomenally well and is fairly easy to set up, once you know how to do it. I am gonna make a quick ressource out of it, it may become helpful for someone in the future.
Thanks again, for your input!
 
Top