Update meshcentral rc script

This commit is contained in:
tschettervictor
2024-09-19 18:29:22 -06:00
committed by GitHub
parent 0387a1bf64
commit 4c6d9f916f

View File

@@ -9,16 +9,39 @@
. /etc/rc.subr
name=meshcentral
user=meshcentral
desc="MeshCentral Computer Management"
rcvar=meshcentral_enable
load_rc_config $name
: ${meshcentral_enable:="NO"}
: ${meshcentral_args:=""}
: ${meshcentral_chdir:="/usr/local/meshcentral"}
: ${meshcentral_rundir:="/var/run/${name}"}
: ${meshcentral_logdir:="/var/log/${name}"}
: ${meshcentral_pidfile:="${meshcentral_rundir}/${name}.pid"}
: ${meshcentral_logfile:="${meshcentral_logdir}/${name}.log"}
pidfile=/var/run/${name}/${name}.pid
user="meshcentral"
group="meshcentral"
node="/usr/local/bin/node"
command="/usr/sbin/daemon"
meshcentral_chdir="/usr/local/meshcentral/node_modules"
command_args="-r -u ${user} -P ${pidfile} /usr/local/bin/node ${meshcentral_chdir}/${name} ${meshcentral_args}"
command_args="-u ${user} -P ${meshcentral_pidfile} -H -o ${meshcentral_logfile} ${node} node_modules/${name} ${meshcentral_args}"
start_precmd="meshcentral_startprecmd"
meshcentral_startprecmd()
{
if [ ! -d ${meshcentral_rundir} ]; then
install -d -o ${user} -g ${group} ${meshcentral_rundir};
else
chown -R ${user}:${group} ${meshcentral_rundir};
fi
if [ ! -d ${meshcentral_logdir} ]; then
install -d -o ${user} -g ${group} ${meshcentral_logdir};
else
chown -R ${user}:${group} ${meshcentral_logdir};
fi
}
load_rc_config $name
run_rc_command "$1"