Closed ivomarino closed 2 months ago
I have actually just merged into the repo a freebsd script which u can install/uninstall etc!
If u want to try do npm install Ylianst/MeshCentral
This will install the development version
Then u can run node node_modules/meshcentral --install
to install --uninstall
to uninstall, --start
to start, etc...
Please can u try that?
Make sure u run npm and node commands with whatever user u want meshcentral to run as!?
Thanks @si458, is it compatible with OpenBSD? rc scripts are bit different between the two. Any link to the commit? Thanks
@ivomarino oh right erm no idea!? I always through freebsd and openbsd are the same! What iso/site did u use so I can create a vm for openbsd and test?
What iso/site did u use so I can create a vm for openbsd and test?
Thought I'd throw this in here. This script works for me. Make sure the user you are running as has ownership of the meshcentral directories, and the meshcentral_chdir
should be the path to you meshcentral directory.
Link to the actual install script is https://github.com/tschettervictor/bsd-apps/blob/main/meshcentral
#!/bin/sh
# MeshCentral FreeBSD Service Script
# PROVIDE: meshcentral
# REQUIRE: NETWORKING
# KEYWORD: shutdown
. /etc/rc.subr
name=meshcentral
desc="MeshCentral Computer Management"
rcvar=meshcentral_enable
load_rc_config $name
: ${meshcentral_enable:="NO"}
: ${meshcentral_args:=""}
: ${meshcentral_chdir:="/usr/local/meshcentral"}
: ${meshcentral_daemon_user:="meshcentral"}
: ${meshcentral_daemon_group:="meshcentral"}
pidfile="/var/run/${name}/${name}.pid"
node="/usr/local/bin/node"
command="/usr/sbin/daemon"
command_args="-u ${meshcentral_daemon_user} -P ${pidfile} -H -o /var/log/${name}/${name}.log ${node} node_modules/${name} ${meshcentral_args}"
start_precmd="meshcentral_startprecmd"
meshcentral_startprecmd()
{
if [ ! -d /var/run/${name} ]; then
install -d -o ${meshcentral_daemon_user} -g ${meshcentral_daemon_group} /var/run/${name};
else
chown -R ${meshcentral_daemon_user}:${meshcentral_daemon_group} /var/run/${name};
fi
if [ ! -d /var/log/${name} ]; then
install -d -o ${meshcentral_daemon_user} -g ${meshcentral_daemon_group} /var/log/${name};
else
chown -R ${meshcentral_daemon_user}:${meshcentral_daemon_group} /var/log/${name};
fi
}
run_rc_command "$1"
One thing to note is the meshcentral_daemon_user
variable. This is necessary because meshcentral will not run properly if that variable is called meshcentral_user
unless that user is root.
This way it allows the daemon command to be run as root, but the actual meshcentral process to run as the specified user.
The user you run as also should be created by pw user add meshcentral -c meshcentral -u 6374 -s /usr/sbin/nologin -d /home/meshcentral -m
as I believe it needs a home directory to install NPM modules. (not 100% sure on this last point)
the new script was included in the 1.1.31 release
so give it a try, make sure to run the commands as whatever user you want meshcentral to run as
node node_modules/meshcentral --install
node node_modules/meshcentral --uninstall
node node_modules/meshcentral --start
node node_modules/meshcentral --stop
node node_modules/meshcentral --restart
I've created this small
rc.d
script in order to run meshcentral on OpenBSD as_meshcentral
user:it actually works but crashes after some time with this error log:
when I run the whole process from
/etc/rc.local
in atmux
session like this:all works fine and the process remains stable, any suggestions? Thanks