Page MenuHomeDevCentral
Paste P339

/usr/local/etc/rc.d/netbox
ActivePublic

Authored by dereckson on Jun 11 2023, 11:12.
Tags
None
Referenced Files
F2239714: /usr/local/etc/rc.d/netbox
Jun 11 2023, 11:12
Subscribers
None
#!/bin/sh
# PROVIDE: netbox
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# netbox_enable (bool): Set it to YES to enable netbox.
# Default is "NO".
# netbox_user (user): Set user to run netbox.
# Default is "netbox".
# netbox_port (int): Set port to run netbox.
# Default is "17000".
. /etc/rc.subr
name=netbox
rcvar=netbox_enable
load_rc_config $name
: ${netbox_enable:="NO"}
: ${netbox_user:="netbox"}
: ${netbox_port:="17000"}
pidfile=/var/run/netbox.pid
procname="/srv/netbox/netbox-3.4.4/service.sh"
command="/usr/sbin/daemon"
command_args="-f -t ${name} -p ${pidfile} /usr/bin/env APP_PORT=${netbox_port} ${procname}"
netbox_precmd()
{
touch ${pidfile}
chown ${netbox_user} ${pidfile}
}
start_precmd=${name}_precmd
run_rc_command "$1"