Skip to content

Auto Startup on FreeNAS Jail

Zeyphros edited this page Apr 3, 2019 · 1 revision

Autostart on FreeBSD and FreeNAS is done through rc, which handles the autostarting and autorebooting of daemons.

To setup auto start for freenas on startup, preferably inside a FreeNAS Jail, you must create an init script.

touch /etc/rc.d/oblecto
edit /etc/rc.d/oblecto

Paste the following init script. Make sure to modify the path of Oblecto to the correct location.

#!/bin/sh
. /etc/rc.subr

PATH="$PATH:/usr/local/bin"
     
name="oblecto"
rcvar=oblecto_enable
     
start_cmd="${name}_start"
stop_cmd=":"

load_rc_config $name
eval "${rcvar}=\${${rcvar}:-'NO'}"
     
oblecto_start()
{
  # And start up the service.

  /usr/lib/node_modules/oblecto/bin/oblecto.js

}
     
run_rc_command "$1"

Now the final step is to run this init srcipt at boot. Add the following to /etc/rc.conf

oblecto_enable="YES"

You can start Oblecto either by restarting your jail or by running service oblecto start.

Clone this wiki locally