aboutsummaryrefslogtreecommitdiff
path: root/libeufin/root/etc/rc.d/rc.libeufin-bank.new
blob: d3ba3e12e54a04d5123b857d75f307dd05729621 (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
54
#!/bin/sh
#
# Startup/shutdown script for GNU Taler's libeufin bank.
#

export USERPROFILE=/var/lib/libeufin

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

start() {
  echo "Starting Libeufin Bank"
  create_run_dir

  daemon \
    --name=libeufin-bank \
    --user=libeufin-bank \
    --pidfiles=/run/libeufin-bank \
    --output=/var/log/taler/libeufin-bank.log \
    -- libeufin-bank serve --config /etc/libeufin/libeufin-bank.conf
}

stop() {
  echo "Stopping Libeufin Bank"
  /usr/bin/daemon --name=libeufin-bank --pidfiles=/run/libeufin-bank --stop
}

status() {
  /usr/bin/daemon --name=libeufin-bank --pidfiles=/run/libeufin-bank --running --verbose
}

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