mirror of
https://github.com/tschettervictor/bsd-apps.git
synced 2025-12-16 06:30:55 +01:00
Update meshcentral rc script
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user