#!/bin/sh
#
# PROVIDE: matrix-synapse
# REQUIRE: DAEMON

if [ -f /etc/rc.subr ]; then
  . /etc/rc.subr
fi

name="matrix-synapse"
rcvar="matrix_synapse"
ctl_command="/usr/pkg/bin/synctl"
conf_file="/usr/pkg/etc/matrix-synapse/homeserver.yaml"
required_files="$conf_file"
pidfile="/var/db/matrix-synapse/homeserver.pid"
#start_precmd="ulimit -n 2048"
: ${synapse_user:=synapse}

start_cmd="/usr/bin/su -m ${synapse_user} -c '${ctl_command} start $conf_file'"
stop_cmd="/usr/bin/su -m ${synapse_user} -c '${ctl_command} stop $conf_file'"

load_rc_config $name
run_rc_command "$1"
