aboutsummaryrefslogtreecommitdiffsponsor
path: root/contrib/slackbuild/rc.mirror
blob: df3c72f10a35cabe1b8f5df68655597be29a5350 (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
#!/bin/sh
#
# Startup/shutdown script for the mirror service.
#

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

start() {
  echo "Starting Mirror service"
  create_run_dir

  daemon \
    --name=mirror \
    --user=mirror \
    --pidfiles=/run/mirror \
    --output=/var/log/mirror/mirror.log \
    -- mirror -config /etc/mirror/mirror.toml
}

stop() {
  echo "Stopping Mirror service"
  /usr/bin/daemon --name=mirror --pidfiles=/run/mirror --stop
}

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

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