#!/bin/sh # # Created by: Mark Felder # PROVIDE: synapse # REQUIRE: LOGIN postgresql # KEYWORD: shutdown # # Add the following line to /etc/rc.conf to enable `synapse': # # synapse_enable="YES" . /etc/rc.subr name=synapse rcvar=synapse_enable load_rc_config ${name} : ${synapse_enable:=NO} : ${synapse_user:=synapse} : ${synapse_conf:=/usr/local/etc/matrix-synapse/homeserver.yaml} : ${synapse_dbdir:=/var/db/matrix-synapse} : ${synapse_logdir:=/var/log/matrix-synapse} : ${synapse_pidfile:=/var/run/matrix-synapse/homeserver.pid} pidfile="${synapse_pidfile}" procname=/usr/local/bin/python3.9 command=/usr/local/bin/python3.9 command_args="-m synapse.app.homeserver --daemonize -c ${synapse_conf}" start_precmd=start_precmd start_precmd() { if [ ! -d ${synapse_pidfile%/*} ] ; then install -d -o ${synapse_user} -g wheel ${synapse_pidfile%/*}; fi if [ ! -d ${synapse_dbdir} ] ; then install -d -o ${synapse_user} -g wheel ${synapse_dbdir}; fi if [ ! -d ${synapse_logdir} ] ; then install -d -o ${synapse_user} -g wheel ${synapse_logdir}; fi } run_rc_command "$1"