aboutsummaryrefslogtreecommitdiff
path: root/dendrite/files/rc.dendrite.new
blob: 1112c811eaf79a247230688c4074714459d9bb35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh
#
# Startup/shutdown script for the matrix Dendrite service.
#

create_run_dir() {
  if [ ! -d /run/dendrite/ ]; then
    mkdir -p /run/dendrite
    chown :dendrite /run/dendrite
    chmod g+wX /run/dendrite
  fi
}

start() {
  echo "Starting matrix Dendrite service"
  create_run_dir

  daemon \
    --chdir=/var/lib/dendrite \
    --name=dendrite \
    --pidfiles=/run/dendrite \
    --user=dendrite \
    -- dendrite -config /etc/dendrite/dendrite.yaml
}

status() {
  create_run_dir

  /usr/bin/daemon --name=dendrite --pidfiles=/run/dendrite --running --verbose
}

stop() {
  echo "Stopping matrix Dendrite service"
  create_run_dir

  /usr/bin/daemon --name=dendrite --pidfiles=/run/dendrite --stop
}

case "$1" in
start)
  start
  ;;
status)
  status
  ;;
stop)
  stop
  ;;
*)
  echo "Usage: $0 {start|stop|status}"
  exit 1
esac