gentoo-repo

git clone git://archive.git.mtrnord.blog/MTRNord/gentoo-repo.git
Log | Files | Refs | README

synapse.initd (846B)


      1 #!/sbin/openrc-run
      2 # Copyright 2019 Gentoo Authors
      3 # Distributed under the terms of the GNU General Public License v2
      4 
      5 description="Reference implementation of Matrix homeserver"
      6 description_reload="Reload configuration and reopen log files."
      7 
      8 su=/bin/su
      9 shell=/bin/bash
     10 user=${SYNAPSE_USER:-synapse}
     11 command=/usr/bin/synctl
     12 conf=${SYNAPSE_CONFIG:-/etc/synapse/homeserver.yaml}
     13 
     14 depend() {
     15 	use dns
     16 	need net
     17 	provide matrix-server
     18 }
     19 
     20 checkconfig() {
     21 	if [ ! -e $SYNAPSE_CONFIG ] ; then
     22 		eerror "You need a $SYNAPSE_CONFIG file to run synapse"
     23 		return 1
     24 	fi
     25 }
     26 
     27 start() {
     28 	checkconfig || return 1
     29 	ebegin "Starting Synapse Matrix homeserver"
     30 	"${su}" "${user}" -c "${command} start ${conf}" -s "${shell}"
     31 	eend $?
     32 }
     33 
     34 stop() {
     35 	ebegin "Stopping Synapse Matrix homeserver"
     36 	"${su}" "${user}" -c "${command} stop ${conf}" -s "${shell}"
     37 	eend $?
     38 }
     39