ansible-base/roles/synapse/templates/mautrix-telegram-control.sh
2024-04-12 21:50:16 +02:00

45 lines
493 B
Bash

#!/usr/bin/env bash
## consts
pidfile="/var/mautrix-telegram/run.pid"
## functions
function start
{
cd {{var_synapse_bridge_mautrix_telegram_directory}}
source ./bin/activate
python -m mautrix_telegram &
pid=$!
echo ${pid} > ${pidfile}
}
function stop
{
pid=$(cat ${pidfile})
kill ${pid}
}
function toggle
{
if $(test ! -e ${pidfile})
then
start
else
stop
fi
}
## args
if $(test $# -ge 1) ; then command=$1 && shift ; else command="toggle" ; fi
## exec
${command}