aboutsummaryrefslogtreecommitdiff
path: root/mautrix-whatsapp/files/rc.mautrix-whatsapp.new
diff options
context:
space:
mode:
Diffstat (limited to 'mautrix-whatsapp/files/rc.mautrix-whatsapp.new')
-rw-r--r--mautrix-whatsapp/files/rc.mautrix-whatsapp.new53
1 files changed, 53 insertions, 0 deletions
diff --git a/mautrix-whatsapp/files/rc.mautrix-whatsapp.new b/mautrix-whatsapp/files/rc.mautrix-whatsapp.new
new file mode 100644
index 0000000..1bc3846
--- /dev/null
+++ b/mautrix-whatsapp/files/rc.mautrix-whatsapp.new
@@ -0,0 +1,53 @@
+#!/bin/sh
+#
+# Startup/shutdown script for the matrix Dendrite service.
+#
+
+create_run_dir() {
+ if [ ! -d /run/mautrix-whatsapp/ ]; then
+ mkdir -p /run/mautrix-whatsapp
+ chown :mautrix-whatsapp /run/mautrix-whatsapp
+ chmod g+wX /run/mautrix-whatsapp
+ fi
+}
+
+start() {
+ echo "Starting matrix Dendrite service"
+ create_run_dir
+
+ daemon \
+ --chdir=/var/lib/mautrix-whatsapp \
+ --name=mautrix-whatsapp \
+ --pidfiles=/run/mautrix-whatsapp \
+ --user=mautrix-whatsapp \
+ -- mautrix-whatsapp --config=/etc/mautrix-whatsapp/config.yaml
+}
+
+status() {
+ create_run_dir
+
+ /usr/bin/daemon --name=mautrix-whatsapp --pidfiles=/run/mautrix-whatsapp --running --verbose
+}
+
+stop() {
+ echo "Stopping matrix Dendrite service"
+ create_run_dir
+
+ /usr/bin/daemon --name=mautrix-whatsapp --pidfiles=/run/mautrix-whatsapp --stop
+}
+
+case "$1" in
+start)
+ start
+ ;;
+status)
+ status
+ ;;
+stop)
+ stop
+ ;;
+*)
+ echo "Usage: $0 {start|stop|status}"
+ exit 1
+esac
+